diff --git a/src/netserver.c b/src/netserver.c
index 2e6b567..ae4ad61 100644
--- a/src/netserver.c
+++ b/src/netserver.c
@@ -220,7 +220,7 @@ unlink_empty_debug_file() {
 #if !defined(WIN32)
   struct stat buf;
 
-  if (stat(FileName,&buf)== 0) {
+  if ( (! suppress_debug) && (stat(FileName,&buf)== 0) ) {
 
     if (buf.st_size == 0)
       unlink(FileName);
@@ -239,6 +239,7 @@ open_debug_file()
   if (where != NULL) fflush(where);
   if (suppress_debug) {
     strncpy(FileName, NETPERF_NULL, sizeof(FileName));
+    FileName[sizeof(FileName) - 1] = '\0';
     where = fopen(FileName, "w");
   } else {
     int fd;
@@ -260,7 +261,8 @@ open_debug_file()
 
 #if !defined(WIN32)
 
-  chmod(FileName,0644);
+  if (! suppress_debug)
+    chmod(FileName,0644);
 
   /* redirect stdin to "/dev/null" */
   rd_null_fp = fopen(NETPERF_NULL,"r");
