Make sure err_info is always set, and print it iff it's non-null.
authorGuy Harris <guy@alum.mit.edu>
Thu, 18 Dec 2014 04:03:47 +0000 (20:03 -0800)
committerGuy Harris <guy@alum.mit.edu>
Thu, 18 Dec 2014 04:04:19 +0000 (04:04 +0000)
Change-Id: Ib5c600c491a3d8adcfa91c00fa9445283610545b
Reviewed-on: https://code.wireshark.org/review/5830
Reviewed-by: Guy Harris <guy@alum.mit.edu>
12 files changed:
capinfos.c
capture_info.c
captype.c
editcap.c
file.c
mergecap.c
randpkt.c
rawshark.c
reordercap.c
tshark.c
wiretap/file_access.c
wiretap/wtap.c

index 785818741d5fa67e1c62437c597e2226ea5e001e..59056267a12f1dfa806e455e1890731fa22dd32e 100644 (file)
@@ -896,22 +896,17 @@ process_cap_file(wtap *wth, const char *filename)
     fprintf(stderr,
         "capinfos: An error occurred after reading %u packets from \"%s\": %s.\n",
         packet, filename, wtap_strerror(err));
-    switch (err) {
-
-      case WTAP_ERR_SHORT_READ:
+    if (err == WTAP_ERR_SHORT_READ) {
+        /* Don't give up completely with this one. */
         status = 1;
         fprintf(stderr,
           "  (will continue anyway, checksums might be incorrect)\n");
-        break;
-
-      case WTAP_ERR_UNSUPPORTED:
-      case WTAP_ERR_BAD_FILE:
-      case WTAP_ERR_DECOMPRESS:
-        fprintf(stderr, "(%s)\n", err_info);
-        g_free(err_info);
-        /* fallthrough */
+    } else {
+        if (err_info != NULL) {
+            fprintf(stderr, "(%s)\n", err_info);
+            g_free(err_info);
+        }
 
-      default:
         g_free(cf_info.encap_counts);
         return 1;
     }
@@ -1481,14 +1476,9 @@ main(int argc, char *argv[])
     if (!wth) {
       fprintf(stderr, "capinfos: Can't open %s: %s\n", argv[opt],
           wtap_strerror(err));
-      switch (err) {
-
-        case WTAP_ERR_UNSUPPORTED:
-        case WTAP_ERR_BAD_FILE:
-        case WTAP_ERR_DECOMPRESS:
-          fprintf(stderr, "(%s)\n", err_info);
-          g_free(err_info);
-          break;
+      if (err_info != NULL) {
+        fprintf(stderr, "(%s)\n", err_info);
+        g_free(err_info);
       }
       overall_error_status = 1; /* remember that an error has occurred */
       if (!continue_after_wtap_open_offline_failure)
index 753bba0e80c68b22d93ec44be11bd0460cea0c62..3989d00faa49ab4748459ccb68df10faee802efa 100644 (file)
@@ -125,7 +125,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
             /* Seen only when opening a capture file for reading. */
             g_snprintf(errmsg_errno, sizeof(errmsg_errno),
                        "The file \"%%s\" contains record data that Wireshark doesn't support.\n"
-                       "(%s)", err_info);
+                       "(%s)", err_info != NULL ? err_info : "no information supplied");
             g_free(err_info);
             errmsg = errmsg_errno;
             break;
@@ -159,7 +159,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
             /* Seen only when opening a capture file for reading. */
             g_snprintf(errmsg_errno, sizeof(errmsg_errno),
                        "The file \"%%s\" appears to be damaged or corrupt.\n"
-                       "(%s)", err_info);
+                       "(%s)", err_info != NULL ? err_info : "no information supplied");
             g_free(err_info);
             errmsg = errmsg_errno;
             break;
@@ -183,7 +183,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
         case WTAP_ERR_DECOMPRESS:
             g_snprintf(errmsg_errno, sizeof(errmsg_errno),
                        "The compressed file \"%%s\" appears to be damaged or corrupt.\n"
-                       "(%s)", err_info);
+                       "(%s)", err_info != NULL ? err_info : "no information supplied");
             g_free(err_info);
             errmsg = errmsg_errno;
             break;
index e06236130e2d6894a15115b0714ad7accb848cfe..0864ba6222b3d331842d0e396c2be927f444e0c3 100644 (file)
--- a/captype.c
+++ b/captype.c
@@ -254,13 +254,9 @@ main(int argc, char *argv[])
       else {
         fprintf(stderr, "captype: Can't open %s: %s\n", argv[i],
                 wtap_strerror(err));
-        switch (err) {
-
-        case WTAP_ERR_UNSUPPORTED:
-        case WTAP_ERR_BAD_FILE:
+        if (err_info != NULL) {
           fprintf(stderr, "(%s)\n", err_info);
           g_free(err_info);
-          break;
         }
         overall_error_status = 1; /* remember that an error has occurred */
       }
index 91ed791b95422fa531bfa07be971030eb1a1e96d..78338618e46ab8df32f68f572305125dc0db822d 100644 (file)
--- a/editcap.c
+++ b/editcap.c
@@ -1249,12 +1249,9 @@ main(int argc, char *argv[])
     if (!wth) {
         fprintf(stderr, "editcap: Can't open %s: %s\n", argv[optind],
                 wtap_strerror(err));
-        switch (err) {
-        case WTAP_ERR_UNSUPPORTED:
-        case WTAP_ERR_BAD_FILE:
+        if (err_info != NULL) {
             fprintf(stderr, "(%s)\n", err_info);
             g_free(err_info);
-            break;
         }
         exit(2);
     }
@@ -1689,7 +1686,7 @@ main(int argc, char *argv[])
                                 "editcap: Record %u of \"%s\" has data that can't be saved in a \"%s\" file.\n(%s)\n",
                                 read_count, argv[optind],
                                 wtap_file_type_subtype_string(out_file_type_subtype),
-                                err_info);
+                                err_info != NULL ? err_info : "no information supplied");
                         g_free(err_info);
                         break;
 
@@ -1714,12 +1711,9 @@ main(int argc, char *argv[])
             fprintf(stderr,
                     "editcap: An error occurred while reading \"%s\": %s.\n",
                     argv[optind], wtap_strerror(err));
-            switch (err) {
-            case WTAP_ERR_UNSUPPORTED:
-            case WTAP_ERR_BAD_FILE:
+            if (err_info != NULL) {
                 fprintf(stderr, "(%s)\n", err_info);
                 g_free(err_info);
-                break;
             }
         }
 
diff --git a/file.c b/file.c
index 757997cb8275acd7e6e6c43346271e5d868905b8..6657ca7401440b0cd6b351df77df5a61116bf26e 100644 (file)
--- a/file.c
+++ b/file.c
@@ -743,7 +743,7 @@ cf_read(capture_file *cf, gboolean reloading)
     case WTAP_ERR_UNSUPPORTED:
       simple_error_message_box(
                  "The capture file contains record data that Wireshark doesn't support.\n(%s)",
-                 err_info);
+                 err_info != NULL ? err_info : "no information supplied");
       g_free(err_info);
       break;
 
@@ -756,14 +756,14 @@ cf_read(capture_file *cf, gboolean reloading)
     case WTAP_ERR_BAD_FILE:
       simple_error_message_box(
                  "The capture file appears to be damaged or corrupt.\n(%s)",
-                 err_info);
+                 err_info != NULL ? err_info : "no information supplied");
       g_free(err_info);
       break;
 
     case WTAP_ERR_DECOMPRESS:
       simple_error_message_box(
-                 "The compressed capture file appears to be damaged or corrupt.\n"
-                 "(%s)", err_info);
+                 "The compressed capture file appears to be damaged or corrupt.\n",
+                 err_info != NULL ? err_info : "no information supplied");
       g_free(err_info);
       break;
 
@@ -887,10 +887,14 @@ cf_continue_tail(capture_file *cf, volatile int to_read, int *err)
   } else if (*err != 0) {
     /* We got an error reading the capture file.
        XXX - pop up a dialog box instead? */
-    g_warning("Error \"%s\" while reading: \"%s\" (\"%s\")",
-        wtap_strerror(*err), err_info, cf->filename);
-    g_free(err_info);
-
+    if (err_info != NULL) {
+      g_warning("Error \"%s\" while reading \"%s\" (\"%s\")",
+                wtap_strerror(*err), cf->filename, err_info);
+      g_free(err_info);
+    } else {
+      g_warning("Error \"%s\" while reading \"%s\"",
+                wtap_strerror(*err), cf->filename);
+    }
     return CF_READ_ERROR;
   } else
     return CF_READ_OK;
@@ -992,10 +996,14 @@ cf_finish_tail(capture_file *cf, int *err)
   if (*err != 0) {
     /* We got an error reading the capture file.
        XXX - pop up a dialog box? */
-
-    g_warning("Error \"%s\" while reading: \"%s\" (\"%s\")",
-        wtap_strerror(*err), err_info, cf->filename);
-    g_free(err_info);
+    if (err_info != NULL) {
+      g_warning("Error \"%s\" while reading \"%s\" (\"%s\")",
+                wtap_strerror(*err), cf->filename, err_info);
+      g_free(err_info);
+    } else {
+      g_warning("Error \"%s\" while reading \"%s\"",
+                wtap_strerror(*err), cf->filename);
+    }
     return CF_READ_ERROR;
   } else {
     return CF_READ_OK;
@@ -1535,7 +1543,8 @@ cf_merge_files(char **out_filenamep, int in_file_count,
         case WTAP_ERR_DECOMPRESS:
           simple_error_message_box(
                      "The compressed capture file %s appears to be damaged or corrupt.\n"
-                     "(%s)", display_basename, err_info);
+                     "(%s)", display_basename,
+                     err_info != NULL ? err_info : "no information supplied");
           g_free(err_info);
           break;
 
@@ -1610,7 +1619,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
                       "Record %u of \"%s\" has data that can't be saved in a \"%s\" file.\n(%s)",
                       in_file ? in_file->packet_num : 0, display_basename,
                       wtap_file_type_subtype_string(file_type),
-                      write_err_info);
+                      write_err_info != NULL ? write_err_info : "no information supplied");
         g_free(write_err_info);
         g_free(display_basename);
         break;
@@ -1746,7 +1755,8 @@ cf_read_record_r(capture_file *cf, const frame_data *fdata,
 
     case WTAP_ERR_BAD_FILE:
       simple_error_message_box("An error occurred while reading from the file \"%s\": %s.\n(%s)",
-                 display_basename, wtap_strerror(err), err_info);
+                 display_basename, wtap_strerror(err),
+                 err_info != NULL ? err_info : "no information supplied");
       g_free(err_info);
       break;
 
@@ -4203,7 +4213,7 @@ save_record(capture_file *cf, frame_data *fdata,
         simple_error_message_box(
                       "Record %u has data that can't be saved in a \"%s\" file.\n(%s)",
                       fdata->num, wtap_file_type_subtype_string(args->file_type),
-                      err_info);
+                      err_info != NULL ? err_info : "no information supplied");
         g_free(err_info);
         break;
 
@@ -4519,7 +4529,7 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
     case WTAP_ERR_UNSUPPORTED:
       simple_error_message_box(
                  "The capture file contains record data that Wireshark doesn't support.\n(%s)",
-                 err_info);
+                 err_info != NULL ? err_info : "no information supplied");
       g_free(err_info);
       break;
 
@@ -4532,14 +4542,15 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
     case WTAP_ERR_BAD_FILE:
       simple_error_message_box(
                  "The capture file appears to be damaged or corrupt.\n(%s)",
-                 err_info);
+                 err_info != NULL ? err_info : "no information supplied");
       g_free(err_info);
       break;
 
     case WTAP_ERR_DECOMPRESS:
       simple_error_message_box(
                  "The compressed capture file appears to be damaged or corrupt.\n"
-                 "(%s)", err_info);
+                 "(%s)",
+                 err_info != NULL ? err_info : "no information supplied");
       g_free(err_info);
       break;
 
@@ -5036,7 +5047,8 @@ cf_open_failure_alert_box(const char *filename, int err, gchar *err_info,
       simple_error_message_box(
             "The file \"%s\" contains record data that Wireshark doesn't support.\n",
             "(%s)",
-            display_basename, err_info);
+            display_basename,
+            err_info != NULL ? err_info : "no information supplied");
       g_free(err_info);
       break;
 
@@ -5075,7 +5087,8 @@ cf_open_failure_alert_box(const char *filename, int err, gchar *err_info,
       simple_error_message_box(
             "The file \"%s\" appears to be damaged or corrupt.\n"
             "(%s)",
-            display_basename, err_info);
+            display_basename,
+            err_info != NULL ? err_info : "no information supplied");
       g_free(err_info);
       break;
 
@@ -5112,7 +5125,8 @@ cf_open_failure_alert_box(const char *filename, int err, gchar *err_info,
     case WTAP_ERR_DECOMPRESS:
       simple_error_message_box(
             "The compressed file \"%s\" appears to be damaged or corrupt.\n"
-            "(%s)", display_basename, err_info);
+            "(%s)", display_basename,
+            err_info != NULL ? err_info : "no information supplied");
       g_free(err_info);
       break;
 
index 82b26403e7b13bbf44d472d8df384fa09720152e..7bcada4f996a42806c5a16962aa822f4a0a48996 100644 (file)
@@ -374,13 +374,9 @@ main(int argc, char *argv[])
                            &open_err, &err_info, &err_fileno)) {
     fprintf(stderr, "mergecap: Can't open %s: %s\n", argv[optind + err_fileno],
             wtap_strerror(open_err));
-    switch (open_err) {
-
-    case WTAP_ERR_UNSUPPORTED:
-    case WTAP_ERR_BAD_FILE:
+    if (err_info != NULL) {
       fprintf(stderr, "(%s)\n", err_info);
       g_free(err_info);
-      break;
     }
     return 2;
   }
@@ -542,13 +538,9 @@ main(int argc, char *argv[])
       if (in_files[i].state == GOT_ERROR) {
         fprintf(stderr, "mergecap: Error reading %s: %s\n",
                 in_files[i].filename, wtap_strerror(read_err));
-        switch (read_err) {
-
-        case WTAP_ERR_UNSUPPORTED:
-        case WTAP_ERR_BAD_FILE:
+        if (err_info != NULL) {
           fprintf(stderr, "(%s)\n", err_info);
           g_free(err_info);
-          break;
         }
       }
     }
@@ -599,7 +591,7 @@ main(int argc, char *argv[])
       fprintf(stderr, "mergecap: Record %u of \"%s\" has data that can't be saved in a \"%s\" file.\n(%s)\n",
               in_file ? in_file->packet_num : 0, in_file ? in_file->filename : "UNKNOWN",
               wtap_file_type_subtype_string(file_type),
-              write_err_info);
+              write_err_info != NULL ? write_err_info : "no information supplied");
       g_free(write_err_info);
       break;
 
index 1ec7d18baa7b523df5033ac8e571baad2789f82e..d19545987f8af3cbfcad4d3509d2ae69bf09e863 100644 (file)
--- a/randpkt.c
+++ b/randpkt.c
@@ -622,15 +622,8 @@ main(int argc, char **argv)
 
                /* XXX - report errors! */
                if (!wtap_dump(dump, &pkthdr, &buffer[0], &err, &err_info)) {
-                       switch (err) {
-
-                       case WTAP_ERR_UNWRITABLE_REC_DATA:
+                       if (err_info != NULL)
                                g_free(err_info);
-                               break;
-
-                       default:
-                               break;
-                       }
                }
        }
 
index 0fc46c05c4dd2d14a6b3abcff679c0d96c023289..f70c4185266dd2c6cc84ffaa1a3bf3860af78d9c 100644 (file)
@@ -1008,7 +1008,8 @@ load_cap_file(capture_file *cf)
 
             case WTAP_ERR_UNSUPPORTED:
                 cmdarg_err("The file \"%s\" contains record data that Rawshark doesn't support.\n(%s)",
-                           cf->filename, err_info);
+                           cf->filename,
+                           err_info != NULL ? err_info : "no information supplied");
                 g_free(err_info);
                 break;
 
@@ -1019,13 +1020,15 @@ load_cap_file(capture_file *cf)
 
             case WTAP_ERR_BAD_FILE:
                 cmdarg_err("The file \"%s\" appears to be damaged or corrupt.\n(%s)",
-                           cf->filename, err_info);
+                           cf->filename,
+                           err_info != NULL ? err_info : "no information supplied");
                 g_free(err_info);
                 break;
 
             case WTAP_ERR_DECOMPRESS:
                 cmdarg_err("The compressed file \"%s\" appears to be damaged or corrupt.\n(%s)",
-                           cf->filename, err_info);
+                           cf->filename,
+                           err_info != NULL ? err_info : "no information supplied");
                 g_free(err_info);
                 break;
 
index b36bc58b405a8e9ee8f6c5bef9e64e9febc2bac3..9ac0b6738f139720c1172950c223e10a6516fe46 100644 (file)
@@ -121,13 +121,9 @@ frame_write(FrameRecord_t *frame, wtap *wth, wtap_dumper *pdh,
             fprintf(stderr,
                     "reordercap: An error occurred while re-reading \"%s\": %s.\n",
                     infile, wtap_strerror(err));
-            switch (err) {
-
-            case WTAP_ERR_UNSUPPORTED:
-            case WTAP_ERR_BAD_FILE:
+            if (err_info != NULL) {
                 fprintf(stderr, "(%s)\n", err_info);
                 g_free(err_info);
-                break;
             }
             exit(1);
         }
@@ -140,18 +136,11 @@ frame_write(FrameRecord_t *frame, wtap *wth, wtap_dumper *pdh,
 
     /* Dump frame to outfile */
     if (!wtap_dump(pdh, phdr, ws_buffer_start_ptr(buf), &err, &err_info)) {
-        switch (err) {
-
-        case WTAP_ERR_UNWRITABLE_REC_DATA:
-            fprintf(stderr, "reordercap: Error (%s) writing frame to outfile (%s)\n",
-                    wtap_strerror(err), err_info);
+        fprintf(stderr, "reordercap: Error (%s) writing frame to outfile\n",
+                wtap_strerror(err));
+        if (err_info != NULL) {
+            fprintf(stderr, "(%s)\n", err_info);
             g_free(err_info);
-            break;
-
-        default:
-            fprintf(stderr, "reordercap: Error (%s) writing frame to outfile\n",
-                    wtap_strerror(err));
-            break;
         }
         exit(1);
     }
@@ -293,13 +282,9 @@ main(int argc, char *argv[])
     if (wth == NULL) {
         fprintf(stderr, "reordercap: Can't open %s: %s\n", infile,
                 wtap_strerror(err));
-        switch (err) {
-
-        case WTAP_ERR_UNSUPPORTED:
-        case WTAP_ERR_BAD_FILE:
+        if (err_info != NULL) {
             fprintf(stderr, "(%s)\n", err_info);
             g_free(err_info);
-            break;
         }
         exit(1);
     }
@@ -349,13 +334,9 @@ main(int argc, char *argv[])
       fprintf(stderr,
               "reordercap: An error occurred while reading \"%s\": %s.\n",
               infile, wtap_strerror(err));
-      switch (err) {
-
-      case WTAP_ERR_UNSUPPORTED:
-      case WTAP_ERR_BAD_FILE:
+      if (err_info != NULL) {
           fprintf(stderr, "(%s)\n", err_info);
           g_free(err_info);
-          break;
       }
     }
 
index cc2cdb3d2dc58623ce242d265918c6fad8f0bf81..f96f49b93067a11635410650de4521d6687c1ee2 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -3300,7 +3300,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
                         "Record %u of \"%s\" has data that can't be saved in a \"%s\" file.\n(%s)\n",
                         framenum, cf->filename,
                         wtap_file_type_subtype_short_string(out_file_type),
-                        err_info);
+                        err_info != NULL ? err_info : "no information supplied");
                 g_free(err_info);
                 break;
 
@@ -3403,7 +3403,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
                       "Record %u of \"%s\" has data that can't be saved in a \"%s\" file.\n(%s)\n",
                       framenum, cf->filename,
                       wtap_file_type_subtype_short_string(out_file_type),
-                      err_info);
+                      err_info != NULL ? err_info : "no information supplied");
               g_free(err_info);
               break;
 
@@ -3465,7 +3465,8 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
 
     case WTAP_ERR_UNSUPPORTED:
       cmdarg_err("The file \"%s\" contains record data that TShark doesn't support.\n(%s)",
-                 cf->filename, err_info);
+                 cf->filename,
+                 err_info != NULL ? err_info : "no information supplied");
       g_free(err_info);
       break;
 
@@ -3476,13 +3477,15 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
 
     case WTAP_ERR_BAD_FILE:
       cmdarg_err("The file \"%s\" appears to be damaged or corrupt.\n(%s)",
-                 cf->filename, err_info);
+                 cf->filename,
+                 err_info != NULL ? err_info : "no information supplied");
       g_free(err_info);
       break;
 
     case WTAP_ERR_DECOMPRESS:
       cmdarg_err("The compressed file \"%s\" appears to be damaged or corrupt.\n"
-                 "(%s)", cf->filename, err_info);
+                 "(%s)", cf->filename,
+                 err_info != NULL ? err_info : "no information supplied");
       g_free(err_info);
       break;
 
@@ -4199,7 +4202,8 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
       /* Seen only when opening a capture file for reading. */
       g_snprintf(errmsg_errno, sizeof(errmsg_errno),
                  "The file \"%%s\" contains record data that TShark doesn't support.\n"
-                 "(%s)", err_info);
+                 "(%s)",
+                 err_info != NULL ? err_info : "no information supplied");
       g_free(err_info);
       errmsg = errmsg_errno;
       break;
@@ -4238,8 +4242,9 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
     case WTAP_ERR_BAD_FILE:
       /* Seen only when opening a capture file for reading. */
       g_snprintf(errmsg_errno, sizeof(errmsg_errno),
-               "The file \"%%s\" appears to be damaged or corrupt.\n"
-               "(%s)", err_info);
+                 "The file \"%%s\" appears to be damaged or corrupt.\n"
+                 "(%s)",
+                 err_info != NULL ? err_info : "no information supplied");
       g_free(err_info);
       errmsg = errmsg_errno;
       break;
@@ -4268,7 +4273,8 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
       /* Seen only when opening a capture file for reading. */
       g_snprintf(errmsg_errno, sizeof(errmsg_errno),
                  "The compressed file \"%%s\" appears to be damaged or corrupt.\n"
-                 "(%s)", err_info);
+                 "(%s)",
+                 err_info != NULL ? err_info : "no information supplied");
       g_free(err_info);
       errmsg = errmsg_errno;
       break;
index c475ffd6a629b9af4c1e3a64b121b359188f5809..730698b91992d81585ff70778cc63d35ed9d5a76 100644 (file)
@@ -726,6 +726,9 @@ wtap_open_offline(const char *filename, unsigned int type, int *err, char **err_
        gboolean use_stdin = FALSE;
        gchar *extension;
 
+       *err = 0;
+       *err_info = NULL;
+
        init_open_routines();
 
        /* open standard input if filename is '-' */
@@ -2318,6 +2321,8 @@ gboolean
 wtap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
          const guint8 *pd, int *err, gchar **err_info)
 {
+       *err = 0;
+       *err_info = NULL;
        return (wdh->subtype_write)(wdh, phdr, pd, err, err_info);
 }
 
index 731ab26091028a67c51a3992ed490bc24f1c86f6..dd7d5aed9ccb011bdf30ba2d7662a2636388fd37 100644 (file)
@@ -1050,6 +1050,8 @@ wtap_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
        wth->phdr.pkt_encap = wth->file_encap;
        wth->phdr.pkt_tsprec = wth->file_tsprec;
 
+       *err = 0;
+       *err_info = NULL;
        if (!wth->subtype_read(wth, err, err_info, data_offset)) {
                /*
                 * If we didn't get an error indication, we read