gen_build_files.sh uses bashism, document it
[oweals/busybox.git] / runit / chpst.c
index 82a81f5492235a15da76adb5af7c76f2425d32bc..1a68eb755320951efa881cfbeb96cb06adc5dcd5 100644 (file)
@@ -92,7 +92,8 @@ enum {
        OPT_2 = (1 << 20) * ENABLE_CHPST,
 };
 
-static void edir(const char *directory_name)
+/* TODO: use recursive_action? */
+static NOINLINE void edir(const char *directory_name)
 {
        int wdir;
        DIR *dir;
@@ -101,9 +102,7 @@ static void edir(const char *directory_name)
 
        wdir = xopen(".", O_RDONLY | O_NDELAY);
        xchdir(directory_name);
-       dir = opendir(".");
-       if (!dir)
-               bb_perror_msg_and_die("opendir %s", directory_name);
+       dir = xopendir(".");
        for (;;) {
                char buf[256];
                char *tail;
@@ -200,11 +199,11 @@ int chpst_main(int argc UNUSED_PARAM, char **argv)
                // if yes -> getopt converts strings to numbers for us
                opt_complementary = "-1:a+:c+:d+:f+:l+:m+:o+:p+:r+:s+:t+";
                opt = getopt32(argv, "+a:c:d:f:l:m:o:p:r:s:t:u:U:e:"
-                       USE_CHPST("/:n:vP012"),
+                       IF_CHPST("/:n:vP012"),
                        &limita, &limitc, &limitd, &limitf, &limitl,
                        &limitm, &limito, &limitp, &limitr, &limits, &limitt,
                        &set_user, &env_user, &env_dir
-                       USE_CHPST(, &root, &nicestr));
+                       IF_CHPST(, &root, &nicestr));
                argv += optind;
                if (opt & OPT_m) { // -m means -asld
                        limita = limits = limitl = limitd = limitm;