]> xenbits.xensource.com Git - people/liuw/freebsd.git/commitdiff
-C and -c allow at most one input file. Ensure this is the case when the
authorgabor <gabor@FreeBSD.org>
Thu, 22 Oct 2015 10:57:15 +0000 (10:57 +0000)
committergabor <gabor@FreeBSD.org>
Thu, 22 Oct 2015 10:57:15 +0000 (10:57 +0000)
input files are specified through --files0-from.

Submitted by: tim@OpenBSD
Obtained from: OpenBSD
MFC after: 1 week

usr.bin/sort/sort.c

index 43ae43ce4650ae48624cb17b1585687196816d99..17f316b8ca3661d23627ef66c38cf57a35376f9e 100644 (file)
@@ -1168,6 +1168,11 @@ main(int argc, char **argv)
        argc -= optind;
        argv += optind;
 
+       if (argv_from_file0) {
+               argc = argc_from_file0;
+               argv = argv_from_file0;
+       }
+
 #ifndef WITHOUT_NLS
        catalog = catopen("sort", NL_CAT_LOCALE);
 #endif
@@ -1205,11 +1210,6 @@ main(int argc, char **argv)
                ks->sm.func = get_sort_func(&(ks->sm));
        }
 
-       if (argv_from_file0) {
-               argc = argc_from_file0;
-               argv = argv_from_file0;
-       }
-
        if (debug_sort) {
                printf("Memory to be used for sorting: %llu\n",available_free_memory);
 #if defined(SORT_THREADS)