--- trunk/mkinitrd-magellan/klibc/usr/dash/jobs.c 2009/04/24 18:09:28 814 +++ trunk/mkinitrd-magellan/klibc/usr/dash/jobs.c 2009/04/24 18:32:46 815 @@ -188,18 +188,14 @@ if (on == jobctl || rootshell == 0) return; if (on) { - int ofd; - ofd = fd = open(_PATH_TTY, O_RDWR); + fd = open(_PATH_TTY, O_RDWR); if (fd < 0) { fd += 3; - while (!isatty(fd) && --fd >= 0) - ; + while (!isatty(fd)) + if (--fd < 0) + goto out; } - fd = fcntl(fd, F_DUPFD, 10); - close(ofd); - if (fd < 0) - goto out; - fcntl(fd, F_SETFD, FD_CLOEXEC); + fd = savefd(fd); do { /* while we are in the background */ if ((pgrp = tcgetpgrp(fd)) < 0) { out: