[or-cvs] r13424: Fix some warnings identified by building with -D_FORTIFY_SOU (in tor/trunk: . src/common src/or)

nickm at seul.org nickm at seul.org
Fri Feb 8 21:09:29 UTC 2008


Author: nickm
Date: 2008-02-08 16:09:29 -0500 (Fri, 08 Feb 2008)
New Revision: 13424

Modified:
   tor/trunk/
   tor/trunk/src/common/util.c
   tor/trunk/src/or/eventdns.c
Log:
 r17967 at catbus:  nickm | 2008-02-07 11:44:51 -0500
 Fix some warnings identified by building with -D_FORTIFY_SOURCE=2.  Remove a redundant (and nuts) definition of _FORTIFY_SOURCE from eventdns.c.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r17967] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/src/common/util.c
===================================================================
--- tor/trunk/src/common/util.c	2008-02-08 15:38:15 UTC (rev 13423)
+++ tor/trunk/src/common/util.c	2008-02-08 21:09:29 UTC (rev 13424)
@@ -3109,7 +3109,10 @@
     return;
   start_daemon_called = 1;
 
-  pipe(daemon_filedes);
+  if (pipe(daemon_filedes)) {
+    log_err(LD_GENERAL,"pipe failed; exiting. Error was %s", strerror(errno));
+    exit(1);
+  }
   pid = fork();
   if (pid < 0) {
     log_err(LD_GENERAL,"fork failed. Exiting.");
@@ -3189,7 +3192,10 @@
   }
   if (nullfd > 2)
     close(nullfd);
-  write(daemon_filedes[1], &c, sizeof(char)); /* signal success */
+  /* signal success */
+  if (write(daemon_filedes[1], &c, sizeof(char)) != sizeof(char)) {
+    log_err(LD_GENERAL,"write failed. Exiting.");
+  }
   close(daemon_filedes[1]);
 }
 #else

Modified: tor/trunk/src/or/eventdns.c
===================================================================
--- tor/trunk/src/or/eventdns.c	2008-02-08 15:38:15 UTC (rev 13423)
+++ tor/trunk/src/or/eventdns.c	2008-02-08 21:09:29 UTC (rev 13424)
@@ -65,8 +65,6 @@
 #include <openssl/rand.h>
 #endif
 
-#define _FORTIFY_SOURCE 3
-
 #include <string.h>
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>



More information about the tor-commits mailing list