diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-04-17 17:39:08 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-04-17 17:39:08 +0300 |
commit | ba85f103e59db924f4dfba7de56bcba8ae311e3c (patch) | |
tree | 5f92e0722a1d531557760891d8861282ef5eb66f /lib | |
parent | 805e294fd638bd3585400e317be81207e4a04388 (diff) | |
download | rpm-ba85f103e59db924f4dfba7de56bcba8ae311e3c.tar.gz rpm-ba85f103e59db924f4dfba7de56bcba8ae311e3c.tar.bz2 rpm-ba85f103e59db924f4dfba7de56bcba8ae311e3c.zip |
Use rstrlcpy() for printFileInfo() username + group fields
- just avoids having to manually ensure zero-termination
Diffstat (limited to 'lib')
-rw-r--r-- | lib/query.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/query.c b/lib/query.c index d642c80a6..f118abac4 100644 --- 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); |