Set err_info to null for errors that don't have an informaton string.
authorGuy Harris <guy@alum.mit.edu>
Wed, 8 Oct 2014 18:44:03 +0000 (11:44 -0700)
committerGuy Harris <guy@alum.mit.edu>
Wed, 8 Oct 2014 18:44:30 +0000 (18:44 +0000)
Change-Id: Ibbcf3496ebfb20c53b953db84b2ddb69083dcb86
Reviewed-on: https://code.wireshark.org/review/4556
Reviewed-by: Guy Harris <guy@alum.mit.edu>
rawshark.c
wiretap/file_wrappers.c

index 3e9a0da992378dd3db6bc68eca3387304706dad9..901187bed402a4b13907ed7c534dc7f0e0005aae 100644 (file)
@@ -966,12 +966,12 @@ raw_pipe_read(struct wtap_pkthdr *phdr, guchar * pd, int *err, const gchar **err
         bytes_read = read(fd, ptr, (int)bytes_needed);
         if (bytes_read == 0) {
             *err = WTAP_ERR_SHORT_READ;
-            *err_info = "Got zero bytes reading data from pipe";
             return FALSE;
         } else if (bytes_read < 0) {
             *err = errno;
             return FALSE;
         }
+        *err_info = NULL;
         bytes_needed -= bytes_read;
         *data_offset += bytes_read;
         ptr += bytes_read;
index 667727346ec559b1d2de7e9c8a3ff152978052eb..d0a28e3d9835f9e62aa5813713869a6ec8495508 100644 (file)
@@ -1364,7 +1364,8 @@ file_error(FILE_T fh, gchar **err_info)
     if (fh->err!=0 && err_info) {
         /* g_strdup() returns NULL for NULL argument */
         *err_info = g_strdup(fh->err_info);
-    }
+    } else
+        *err_info = NULL;
     return fh->err;
 }