tsrc/cmd/tar.c: avoid conflict with strnlen in libc - plan9port - [fork] Plan 9 from user space
(HTM) git clone git://src.adamsgaard.dk/plan9port
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 1a22c43f78a9accbcfcffca1b0e3718e4d90e869
(DIR) parent 112a2c5892067edbd48c020caec80fa455c0d07b
(HTM) Author: Albert Lee <trisk@acm.jhu.edu>
Date: Mon, 1 Dec 2008 19:41:36 -0500
src/cmd/tar.c: avoid conflict with strnlen in libc
Diffstat:
M src/cmd/tar.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/src/cmd/tar.c b/src/cmd/tar.c
t@@ -423,7 +423,7 @@ isustar(Hdr *hp)
* be NUL.
*/
static int
-strnlen(char *s, int n)
+sstrnlen(char *s, int n)
{
return s[n - 1] != '\0'? n: strlen(s);
}
t@@ -437,7 +437,7 @@ name(Hdr *hp)
char *fullname;
fullname = fullnamebuf+2;
- namlen = strnlen(hp->name, sizeof hp->name);
+ namlen = sstrnlen(hp->name, sizeof hp->name);
if (hp->prefix[0] == '\0' || !isustar(hp)) { /* old-style name? */
memmove(fullname, hp->name, namlen);
fullname[namlen] = '\0';
t@@ -445,7 +445,7 @@ name(Hdr *hp)
}
/* name is in two pieces */
- pfxlen = strnlen(hp->prefix, sizeof hp->prefix);
+ pfxlen = sstrnlen(hp->prefix, sizeof hp->prefix);
memmove(fullname, hp->prefix, pfxlen);
fullname[pfxlen] = '/';
memmove(fullname + pfxlen + 1, hp->name, namlen);