#include <sys/ioctl.h>
#include <errno.h>
#include <sys/stat.h>
-#include <sys/signal.h>
+#include <signal.h>
#include <fcntl.h>
#include <stdarg.h>
#include <ctype.h>
struct chardata *cp);
static int caps_lock(const char *s);
static int bcode(const char *s);
-static void error(const char *fmt, ...) __attribute__ ((noreturn));
+static void error(const char *fmt, ...) ATTRIBUTE_NORETURN;
#ifdef SYSV_STYLE
#ifdef CONFIG_FEATURE_UTMP
/* Open the tty as standard input. */
+ close(0);
debug("open(2)\n");
fd = open(tty, O_RDWR | O_NONBLOCK, 0);
- if (dup2(fd, STDIN_FILENO) == -1)
+ if (fd != 0)
error("/dev/%s: cannot open as standard input: %m", tty);
- close(fd);
-
} else {
/*