diff options
author | Quentin Young <qlyoung@users.noreply.github.com> | 2018-06-21 21:02:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-21 21:02:31 +0200 |
commit | 7c25948eca83a6115dde1a7f2688827cd93142e0 (patch) | |
tree | d448ccb3f8fc2db4f890ae59f3e38b8f851c7df9 /tools/start-stop-daemon.c | |
parent | Merge pull request #2511 from pacovn/Coverity_1452287_et_al_Explicit_null_der... (diff) | |
parent | tools: return check (2) (Coverity 1143220) (diff) | |
download | frr-7c25948eca83a6115dde1a7f2688827cd93142e0.tar.xz frr-7c25948eca83a6115dde1a7f2688827cd93142e0.zip |
Merge pull request #2505 from pacovn/Coverity_1143220_Argument_cannot_be_negative
tools: return check (2) (Coverity 1143220)
Diffstat (limited to 'tools/start-stop-daemon.c')
-rw-r--r-- | tools/start-stop-daemon.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/start-stop-daemon.c b/tools/start-stop-daemon.c index 8c3fe0c3c..de58e0a20 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 */ |