Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/ppp/dist/pppd CID 271284: Missing error check o...



details:   https://anonhg.NetBSD.org/src/rev/5585f1305287
branches:  trunk
changeset: 325087:5585f1305287
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Dec 04 15:05:49 2013 +0000

description:
CID 271284: Missing error check on open

diffstat:

 external/bsd/ppp/dist/pppd/main.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 2a6ba471dff9 -r 5585f1305287 external/bsd/ppp/dist/pppd/main.c
--- a/external/bsd/ppp/dist/pppd/main.c Wed Dec 04 14:47:41 2013 +0000
+++ b/external/bsd/ppp/dist/pppd/main.c Wed Dec 04 15:05:49 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.2 2013/11/28 22:33:42 christos Exp $        */
+/*     $NetBSD: main.c,v 1.3 2013/12/04 15:05:49 christos Exp $        */
 
 /*
  * main.c - Point-to-Point Protocol main module
@@ -73,7 +73,7 @@
 #define RCSID  "Id: main.c,v 1.156 2008/06/23 11:47:18 paulus Exp "
 static const char rcsid[] = RCSID;
 #else
-__RCSID("$NetBSD: main.c,v 1.2 2013/11/28 22:33:42 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.3 2013/12/04 15:05:49 christos Exp $");
 #endif
 
 #include <stdio.h>
@@ -1682,8 +1682,13 @@
 
     if (log_to_fd >= 0)
        errfd = log_to_fd;
-    else
+    else {
        errfd = open(_PATH_CONNERRS, O_WRONLY | O_APPEND | O_CREAT, 0600);
+       if (errfd == -1) {
+           error("Cannot open `%s': %m", _PATH_CONNERRS);
+           return -1;
+       }
+    }
 
     ++conn_running;
     pid = safe_fork(in, out, errfd);



Home | Main Index | Thread Index | Old Index