From: Kevin Cernekee Date: Wed, 13 Jul 2011 07:30:36 +0000 (+0200) Subject: cttyhack: fail gracefully if the device node is missing X-Git-Tag: 1_19_0~25 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=43a668b2eef5f77d1fe0bee1289cea6649fa793d;p=oweals%2Fbusybox.git cttyhack: fail gracefully if the device node is missing Signed-off-by: Kevin Cernekee Signed-off-by: Denys Vlasenko --- diff --git a/shell/cttyhack.c b/shell/cttyhack.c index 522a1ba73..4261289b4 100644 --- a/shell/cttyhack.c +++ b/shell/cttyhack.c @@ -146,7 +146,9 @@ int cttyhack_main(int argc UNUSED_PARAM, char **argv) goto ret; } 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); dup2(fd, 0); dup2(fd, 1);