summaryrefslogtreecommitdiffstats
path: root/tools/start-stop-daemon.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@users.noreply.github.com>2018-06-21 21:02:31 +0200
committerGitHub <noreply@github.com>2018-06-21 21:02:31 +0200
commit7c25948eca83a6115dde1a7f2688827cd93142e0 (patch)
treed448ccb3f8fc2db4f890ae59f3e38b8f851c7df9 /tools/start-stop-daemon.c
parentMerge pull request #2511 from pacovn/Coverity_1452287_et_al_Explicit_null_der... (diff)
parenttools: return check (2) (Coverity 1143220) (diff)
downloadfrr-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.c6
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 */