Any ok for this, and the same for rcs? (And ssh?)
On Wed, Jun 17, 2015 at 08:42:04PM +0200, Fritjof Bornebusch wrote:
> Hi tech@,
>
> as requested by nicm@, xstrdup calls strdup(3) now.
>
> Regards,
> --F.
>
>
> Index: xmalloc.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/diff/xmalloc.c,v
> retrieving revision 1.6
> diff -u -p -r1.6 xmalloc.c
> --- xmalloc.c 29 Apr 2015 04:00:25 -0000 1.6
> +++ xmalloc.c 17 Jun 2015 18:13:25 -0000
> @@ -73,12 +73,10 @@ xfree(void *ptr)
> char *
> xstrdup(const char *str)
> {
> - size_t len;
> char *cp;
> -
> - len = strlen(str) + 1;
> - cp = xmalloc(len);
> - strlcpy(cp, str, len);
> +
> + if ((cp = strdup(str)) == NULL)
> + err(1, "xstrdup");
> return cp;
> }
>