diff options
author | jmallett <jmallett@FreeBSD.org> | 2002-05-04 00:08:06 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2002-05-04 00:08:06 +0000 |
commit | 48ff9098aa9307bb2e8449b4f419c02a51884942 (patch) | |
tree | 1cc4b9e539362ab6c4ae46ad2a7c4e80c4cb7dd9 /usr.bin/xargs | |
parent | 33e9ccad7c14095ca64972f240e4c19691850faf (diff) | |
download | FreeBSD-src-48ff9098aa9307bb2e8449b4f419c02a51884942.zip FreeBSD-src-48ff9098aa9307bb2e8449b4f419c02a51884942.tar.gz |
Replace calloc(3) with malloc(3), and set the tail of the
argument list to NULL, to terminate the arguments passed
to execvp(2).
Thanks to: bde (for pointing out some missing parens)
And with apologies to Ozzy Osbourne:
On his way to dinner
It took him by surprise
When an email from bde
Said his code was full of lies
Style (indentation)
And his bracing were all wrong
He casted to size_t
When he should have cast to long
I don't mind
Single letter identifiers
Unwrapped Line
Over 80 chars
Far over 80 chars
Who can we get to send diffs
We need Bruce D. Evans
Shows you comparason to his
We need Bruce D. Evans again
Diffstat (limited to 'usr.bin/xargs')
-rw-r--r-- | usr.bin/xargs/xargs.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c index 3cef98a..b14315a 100644 --- a/usr.bin/xargs/xargs.c +++ b/usr.bin/xargs/xargs.c @@ -380,9 +380,9 @@ prerun(int argc, char **argv, int repls, const char *replstr, char **xp, char ** * Allocate memory to hold the argument list, and * a NULL at the tail. */ - tmp = calloc(argc + 1, sizeof(char**)); + tmp = malloc((argc + 1) * sizeof(char**)); if (tmp == NULL) - err(1, "calloc"); + err(1, "malloc"); tmp2 = tmp; /* @@ -415,6 +415,7 @@ prerun(int argc, char **argv, int repls, const char *replstr, char **xp, char ** /* * Run it. */ + *tmp = NULL; run(tmp2); /* |