runsv: run ./finish with parameters (runit compat)
[oweals/busybox.git] / editors / diff.c
index 7fce70d08373cd8c32c2d310e2a6fe4eb013f48a..e3933e72424cc22ada27a9a76227e10e0431ac60 100644 (file)
@@ -103,8 +103,8 @@ struct globals {
        smallint exit_status;
        int opt_U_context;
        size_t max_context;     /* size of context_vec_start */
-       USE_FEATURE_DIFF_DIR(int dl_count;)
-       USE_FEATURE_DIFF_DIR(char **dl;)
+       IF_FEATURE_DIFF_DIR(int dl_count;)
+       IF_FEATURE_DIFF_DIR(char **dl;)
        char *opt_S_start;
        const char *label1;
        const char *label2;
@@ -1298,6 +1298,8 @@ int diff_main(int argc UNUSED_PARAM, char **argv)
         */
        f1 = argv[0];
        f2 = argv[1];
+       /* Compat: "diff file name_which_doesnt_exist" exits with 2 */
+       xfunc_error_retval = 2;
        if (LONE_DASH(f1)) {
                fstat(STDIN_FILENO, &stb1);
                gotstdin++;
@@ -1308,6 +1310,7 @@ int diff_main(int argc UNUSED_PARAM, char **argv)
                gotstdin++;
        } else
                xstat(f2, &stb2);
+       xfunc_error_retval = 1;
 
        if (gotstdin && (S_ISDIR(stb1.st_mode) || S_ISDIR(stb2.st_mode)))
                bb_error_msg_and_die("can't compare stdin to a directory");