svn commit: r286601 - head/usr.bin/patch

Ed Schouten ed at nuxi.nl
Mon Aug 10 21:40:32 UTC 2015


Hi Xin,

2015-08-10 23:31 GMT+02:00 Xin LI <delphij at freebsd.org>:
> +                               argp[0] = strdup(RCSDIFF);
> +                               argp[1] = strdup(filename);
> ...
> +                               free(argp[1]);
> +                               free(argp[0]);

> +                       argp[0] = strdup(CHECKOUT);
> +                       argp[1] = strdup("-l");
> +                       argp[2] = strdup(filename);
> ...
> +                       free(argp[2]);
> +                       free(argp[1]);
> +                       free(argp[0]);

There's no need to call strdup() here, right? As far as I know,
execve() and posix_spawn() don't modify the arguments/environment.
These functions should use "const char *const *" as its argument type,
but that cannot be used, as it would cause compiler errors if "char
**" is passed in.

See the table close to the bottom of this article:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/execve.html

-- 
Ed Schouten <ed at nuxi.nl>
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717


More information about the svn-src-head mailing list