cttyhack: fail gracefully if the device node is missing

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Kevin Cernekee 2011-07-13 09:30:36 +02:00 committed by Denys Vlasenko
parent 064e99646a
commit 43a668b2ee

View File

@ -146,7 +146,9 @@ int cttyhack_main(int argc UNUSED_PARAM, char **argv)
goto ret; goto ret;
} while (0); } while (0);
fd = xopen(console, O_RDWR); fd = open_or_warn(console, O_RDWR);
if (fd < 0)
goto ret;
//bb_error_msg("switching to '%s'", console); //bb_error_msg("switching to '%s'", console);
dup2(fd, 0); dup2(fd, 0);
dup2(fd, 1); dup2(fd, 1);