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;
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;
// 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;
} else {
option_mask32 = opt = 0;
argv++;
+ if (!*argv)
+ bb_show_usage();
}
// envdir?
}
// setuidgid?
- if (ENABLE_SETUIDGID && applet_name[0] == 's') {
+ if (ENABLE_SETUIDGID && applet_name[1] == 'e') {
set_user = *argv++;
opt |= OPT_u;
}
if (opt & OPT_2)
close(STDERR_FILENO);
- BB_EXECVP(argv[0], argv);
- bb_perror_msg_and_die("exec %s", argv[0]);
+ BB_EXECVP_or_die(argv);
}