From: paco Date: Wed, 20 Jun 2018 16:41:48 +0000 (+0200) Subject: tools: return check (2) (Coverity 1143220) X-Git-Tag: frr-6.1-dev~264^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=9b606d6c3d38cb959abeb661209a93e2b9820bc5;p=matthieu%2Ffrr.git tools: return check (2) (Coverity 1143220) Previous correction (657f9948ed593387d29d391832c18dc04326a5a9) was incomplete. Signed-off-by: F. Aragon --- diff --git a/tools/start-stop-daemon.c b/tools/start-stop-daemon.c index 4758d20666..ac0f76233c 100644 --- a/tools/start-stop-daemon.c +++ b/tools/start-stop-daemon.c @@ -1024,8 +1024,10 @@ int main(int argc, char **argv) close(i); /* change tty */ fd = open("/dev/tty", O_RDWR); - ioctl(fd, TIOCNOTTY, 0); - close(fd); + if (fd >= 0) { + ioctl(fd, TIOCNOTTY, 0); + close(fd); + } chdir("/"); umask(022); /* set a default for dumb programs */ setpgid(0, 0); /* set the process group */