projects
/
tools
/
librpm-tizen.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
805e294
)
Use rstrlcpy() for printFileInfo() username + group fields
author
Panu Matilainen
<pmatilai@redhat.com>
Thu, 17 Apr 2008 14:39:08 +0000
(17:39 +0300)
committer
Panu Matilainen
<pmatilai@redhat.com>
Thu, 17 Apr 2008 14:39:08 +0000
(17:39 +0300)
- just avoids having to manually ensure zero-termination
lib/query.c
patch
|
blob
|
history
diff --git
a/lib/query.c
b/lib/query.c
index
d642c80
..
f118aba
100644
(file)
--- a/
lib/query.c
+++ b/
lib/query.c
@@
-50,11
+50,8
@@
static void printFileInfo(const char * name,
if (tm) nowtm = *tm; /* structure assignment */
}
- strncpy(ownerfield, owner, sizeof(ownerfield));
- ownerfield[sizeof(ownerfield)-1] = '\0';
-
- strncpy(groupfield, group, sizeof(groupfield));
- groupfield[sizeof(groupfield)-1] = '\0';
+ rstrlcpy(ownerfield, owner, sizeof(ownerfield));
+ rstrlcpy(groupfield, group, sizeof(groupfield));
/* this is normally right */
sprintf(sizefield, "%12u", size);