diff options
Diffstat (limited to 'usr.bin/whereis')
-rw-r--r-- | usr.bin/whereis/whereis.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/usr.bin/whereis/whereis.c b/usr.bin/whereis/whereis.c index e78e089..58ca04a 100644 --- a/usr.bin/whereis/whereis.c +++ b/usr.bin/whereis/whereis.c @@ -114,20 +114,16 @@ scanopts(int argc, char **argv) dirlist = &sourcedirs; dolist: i = 0; + *dirlist = realloc(*dirlist, (i + 1) * sizeof(char *)); + (*dirlist)[i] = NULL; while (optind < argc && strcmp(argv[optind], "-f") != 0 && strcmp(argv[optind], "-B") != 0 && strcmp(argv[optind], "-M") != 0 && strcmp(argv[optind], "-S") != 0) { - *dirlist = realloc(*dirlist, - (i + 2) * sizeof(char *)); - if (*dirlist == NULL) - abort(); - (*dirlist)[i] = argv[optind]; - i++; + decolonify(argv[optind], dirlist, &i); optind++; } - (*dirlist)[i] = NULL; break; case 'b': |