Hi tech@,
as requested by nicm@, xstrdup calls strdup(3) now.
Regards,
--F.
Index: xmalloc.c
===================================================================
RCS file: /cvs/src/usr.bin/file/xmalloc.c,v
retrieving revision 1.1
diff -u -p -r1.1 xmalloc.c
--- xmalloc.c 24 Apr 2015 16:24:11 -0000 1.1
+++ xmalloc.c 17 Jun 2015 18:18:10 -0000
@@ -76,13 +76,10 @@ xfree(void *ptr)
char *
xstrdup(const char *str)
{
- size_t len;
char *cp;
- len = strlen(str) + 1;
- cp = xmalloc(len);
- if (strlcpy(cp, str, len) >= len)
- errx(1, "xstrdup: string truncated");
+ if ((cp = strdup(str)) == NULL)
+ err(1, "xstrdup");
return cp;
}