]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sys-linux.c
Various fixes for errors found by coverity static analysis (#109)
[ppp.git] / pppd / sys-linux.c
index b832031f7e269648ad6e33207c8855b2da4a8b34..761aafc88f92530b27264d4bfa87215b66ff194c 100644 (file)
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/time.h>
-#include <sys/errno.h>
 #include <sys/file.h>
 #include <sys/stat.h>
 #include <sys/utsname.h>
 #include <sys/sysmacros.h>
 
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <syslog.h>
@@ -2167,7 +2167,6 @@ int ppp_available(void)
                }
            }
 
-           close (s);
            if (!ok) {
                slprintf(route_buffer, sizeof(route_buffer),
                         "Sorry - PPP driver version %d.%d.%d is out of date\n",
@@ -2177,6 +2176,7 @@ int ppp_available(void)
            }
        }
     }
+    close(s);
     return ok;
 }
 
@@ -2653,7 +2653,10 @@ get_pty(master_fdp, slave_fdp, slave_name, uid)
                warn("Couldn't unlock pty slave %s: %m", pty_name);
 #endif
            if ((sfd = open(pty_name, O_RDWR | O_NOCTTY)) < 0)
+           {
                warn("Couldn't open pty slave %s: %m", pty_name);
+               close(mfd);
+           }
        }
     }
 #endif /* TIOCGPTN */