Hi,
forgot to attach the patch.
Cheers
Nico

-- 
Nico Golde - http://ngolde.de - [EMAIL PROTECTED] - GPG: 0x73647CFF
For security reasons, all text in this mail is double-rot13 encrypted.
--- netperf-2.4.3.orig/src/netlib.h
+++ netperf-2.4.3/src/netlib.h
@@ -424,6 +424,7 @@
 extern  SOCKET  server_sock;
 extern  int     times_up;
 extern  FILE    *where;
+extern int      fd;
 extern  int     loops_per_msec;
 extern  float   lib_local_per_cpu_util[];
   
--- netperf-2.4.3.orig/src/netserver.c
+++ netperf-2.4.3/src/netserver.c
@@ -147,6 +147,9 @@
 char    listen_port[10];
 extern	char	*optarg;
 extern	int	optind, opterr;
+#if !defined(WIN_32)
+char debuglog[] = "/tmp/netperf.debugXXXXXX";
+#endif
 
 #ifndef WIN32
 #define SERVER_ARGS "dL:n:p:v:46"
@@ -190,6 +193,10 @@
       if (!debug) 
       {
 	fclose(where);
+#if !defined(WIN32)
+	unlink(debuglog);
+	close(fd);
+#endif
 #if !defined(WIN32) && !defined(MPE) && !defined(__VMS)
 	/* For Unix: reopen the debug write file descriptor to "/dev/null" */
 	/* and redirect stdout to it.					   */
@@ -855,10 +862,15 @@
 
 /*  unlink(DEBUG_LOG_FILE); */
 #ifndef WIN32
-  if ((where = fopen(DEBUG_LOG_FILE, "w")) == NULL) {
+  if((fd = mkstemp(debuglog)) == -1 || (where = fdopen(fd, "w+")) == NULL){
+    if(fd != -1){
+      unlink(debuglog);
+      close(fd);
+    }
     perror("netserver: debug file");
     exit(1);
   }
+
 #else
   {
     char FileName[MAX_PATH];
@@ -887,9 +899,6 @@
   }
 #endif
  
-#ifndef WIN32 
-  chmod(DEBUG_LOG_FILE,0644);
-#endif
   
 #if WIN32
   if (child) {
--- netperf-2.4.3.orig/src/netlib.c
+++ netperf-2.4.3/src/netlib.c
@@ -243,6 +243,7 @@
 union   netperf_response_struct netperf_response;
 
 FILE    *where;
+int fd = -1;
 
 char    libfmt = 'm';
         

Attachment: pgpWvteSjlQCR.pgp
Description: PGP signature



Reply via email to