src/cmd/tar.c: avoid conflict with strnlen in libc
This commit is contained in:
parent
112a2c5892
commit
1a22c43f78
1 changed files with 3 additions and 3 deletions
|
|
@ -423,7 +423,7 @@ isustar(Hdr *hp)
|
||||||
* be NUL.
|
* be NUL.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
strnlen(char *s, int n)
|
sstrnlen(char *s, int n)
|
||||||
{
|
{
|
||||||
return s[n - 1] != '\0'? n: strlen(s);
|
return s[n - 1] != '\0'? n: strlen(s);
|
||||||
}
|
}
|
||||||
|
|
@ -437,7 +437,7 @@ name(Hdr *hp)
|
||||||
char *fullname;
|
char *fullname;
|
||||||
|
|
||||||
fullname = fullnamebuf+2;
|
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? */
|
if (hp->prefix[0] == '\0' || !isustar(hp)) { /* old-style name? */
|
||||||
memmove(fullname, hp->name, namlen);
|
memmove(fullname, hp->name, namlen);
|
||||||
fullname[namlen] = '\0';
|
fullname[namlen] = '\0';
|
||||||
|
|
@ -445,7 +445,7 @@ name(Hdr *hp)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* name is in two pieces */
|
/* name is in two pieces */
|
||||||
pfxlen = strnlen(hp->prefix, sizeof hp->prefix);
|
pfxlen = sstrnlen(hp->prefix, sizeof hp->prefix);
|
||||||
memmove(fullname, hp->prefix, pfxlen);
|
memmove(fullname, hp->prefix, pfxlen);
|
||||||
fullname[pfxlen] = '/';
|
fullname[pfxlen] = '/';
|
||||||
memmove(fullname + pfxlen + 1, hp->name, namlen);
|
memmove(fullname + pfxlen + 1, hp->name, namlen);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue