find: fix regression in status processing for path arguments
authorFelix Fietkau <nbd@openwrt.org>
Thu, 9 Apr 2015 08:20:16 +0000 (10:20 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 14 Apr 2015 14:45:23 +0000 (16:45 +0200)
Regression added in commit 14158b4127dba30466c50147b868a6a89702960b
"find: add optional support for '-exec ... {} +'"

This commit causes find to exit on the first path argument that was not
found, which breaks existing scripts and is incompatible to other
implementations.

Instead of exiting on the first failure, return EXIT_FAILURE at the end
if any error occurred.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
findutils/find.c

index 83aa63f927bfd42b0a4203ac1b6eedeb29ef7700..ced8922e7051a5c482550fd3fbf2d0fffd787b55 100644 (file)
@@ -1460,12 +1460,10 @@ int find_main(int argc UNUSED_PARAM, char **argv)
                                NULL,           /* user data */
                                0)              /* depth */
                ) {
-                       status = EXIT_FAILURE;
-                       goto out;
+                       status |= EXIT_FAILURE;
                }
        }
 
-       IF_FEATURE_FIND_EXEC_PLUS(status = flush_exec_plus();)
-out:
+       IF_FEATURE_FIND_EXEC_PLUS(status |= flush_exec_plus();)
        return status;
 }