Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-12-17 02:49:13 +0300
committerDenis Vlasenko <vda.linux@googlemail.com>2006-12-17 02:49:13 +0300
commit9f739445cd3deddd0343c3a8d5a981ede26bef30 (patch)
tree6dc013e44d2281eb1e6f61c4bca1ae7546001f79 /loginutils
parenta597aaddfa76d589d3e1a37b1f1c3401c2decffd (diff)
inline strcmp(s, "-") [actually macro-ize it for now - gcc is too stupid]
Diffstat (limited to 'loginutils')
-rw-r--r--loginutils/getty.c2
-rw-r--r--loginutils/su.c18
2 files changed, 12 insertions, 8 deletions
diff --git a/loginutils/getty.c b/loginutils/getty.c
index a85e52306..5ceaefcac 100644
--- a/loginutils/getty.c
+++ b/loginutils/getty.c
@@ -239,7 +239,7 @@ static void open_tty(char *tty, struct termios *tp, int local)
/* Set up new standard input, unless we are given an already opened port. */
- if (strcmp(tty, "-")) {
+ if (NOT_LONE_DASH(tty)) {
struct stat st;
int fd;
diff --git a/loginutils/su.c b/loginutils/su.c
index a23ee932b..046457b6f 100644
--- a/loginutils/su.c
+++ b/loginutils/su.c
@@ -14,25 +14,29 @@ int su_main(int argc, char **argv)
char *opt_shell = 0;
char *opt_command = 0;
char *opt_username = "root";
- char **opt_args = 0;
struct passwd *pw;
uid_t cur_uid = getuid();
const char *tty;
char *old_user;
flags = getopt32(argc, argv, "mplc:s:", &opt_command, &opt_shell);
+ argc -= optind;
+ argv -= optind;
#define SU_OPT_mp (3)
#define SU_OPT_l (4)
- if (optind < argc && argv[optind][0] == '-' && argv[optind][1] == 0) {
+ if (argc && LONE_DASH(argv[0])) {
flags |= SU_OPT_l;
- ++optind;
+ argc--;
+ argv++;
}
/* get user if specified */
- if (optind < argc) opt_username = argv [optind++];
-
- if (optind < argc) opt_args = argv + optind;
+ if (argc) {
+ opt_username = argv[0];
+// argc--;
+ argv++;
+ }
if (ENABLE_SU_SYSLOG) {
/* The utmp entry (via getlogin) is probably the best way to identify
@@ -84,7 +88,7 @@ int su_main(int argc, char **argv)
USE_SELINUX(set_current_security_context(NULL);)
/* Never returns */
- run_shell(opt_shell, flags & SU_OPT_l, opt_command, (const char**)opt_args);
+ run_shell(opt_shell, flags & SU_OPT_l, opt_command, (const char**)argv);
return EXIT_FAILURE;
}