summaryrefslogtreecommitdiff
path: root/loginutils
diff options
context:
space:
mode:
authorDenis Vlasenko2007-08-19 13:42:08 +0000
committerDenis Vlasenko2007-08-19 13:42:08 +0000
commitd37f22225b4d10b84bbc4f6cee2e26d9f9b80fac (patch)
tree732f39f3a15dcb56986ffd3900ab2fe3c46d0338 /loginutils
parentb9c02dd791041a4c3b87cb38354268893d739bd0 (diff)
downloadbusybox-d37f22225b4d10b84bbc4f6cee2e26d9f9b80fac.zip
busybox-d37f22225b4d10b84bbc4f6cee2e26d9f9b80fac.tar.gz
libbb,crond,lash: fix getopt32 (don't know how it managed to slip through)
*: fcntl(fd, F_GETFL) doesn't require third parameter at all.
Diffstat (limited to 'loginutils')
-rw-r--r--loginutils/getty.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/loginutils/getty.c b/loginutils/getty.c
index 0c00066..db8d7ce 100644
--- a/loginutils/getty.c
+++ b/loginutils/getty.c
@@ -232,13 +232,11 @@ static void open_tty(const char *tty, struct termios *tp, int local)
int chdir_to_root = 0;
/* Set up new standard input, unless we are given an already opened port. */
-
if (NOT_LONE_DASH(tty)) {
struct stat st;
int fd;
/* Sanity checks... */
-
xchdir("/dev");
chdir_to_root = 1;
xstat(tty, &st);
@@ -246,18 +244,17 @@ static void open_tty(const char *tty, struct termios *tp, int local)
bb_error_msg_and_die("%s: not a character device", tty);
/* Open the tty as standard input. */
-
debug("open(2)\n");
fd = xopen(tty, O_RDWR | O_NONBLOCK);
xdup2(fd, 0);
- while (fd > 2) close(fd--);
+ while (fd > 2)
+ close(fd--);
} else {
/*
* Standard input should already be connected to an open port. Make
* sure it is open for read/write.
*/
-
- if ((fcntl(0, F_GETFL, 0) & O_RDWR) != O_RDWR)
+ if ((fcntl(0, F_GETFL) & O_RDWR) != O_RDWR)
bb_error_msg_and_die("stdin is not open for read/write");
}
@@ -274,7 +271,6 @@ static void open_tty(const char *tty, struct termios *tp, int local)
* by patching the SunOS kernel variable "zsadtrlow" to a larger value;
* 5 seconds seems to be a good value.
*/
-
ioctl_or_perror_and_die(0, TCGETS, tp, "%s: TCGETS", tty);
/*
@@ -362,7 +358,7 @@ static void termios_init(struct termios *tp, int speed, struct options *op)
ioctl(0, TCSETS, tp);
/* go to blocking input even in local mode */
- fcntl(0, F_SETFL, fcntl(0, F_GETFL, 0) & ~O_NONBLOCK);
+ ndelay_off(0);
debug("term_io 2\n");
}
@@ -791,7 +787,7 @@ int getty_main(int argc, char **argv)
if (!(options.flags & F_LOCAL)) {
/* go to blocking write mode unless -L is specified */
- fcntl(1, F_SETFL, fcntl(1, F_GETFL, 0) & ~O_NONBLOCK);
+ ndelay_off(1);
}
/* Optionally detect the baud rate from the modem status message. */