]> wimlib.net Git - wimlib/blobdiff - programs/imagex.c
dentry.c: Comment fix
[wimlib] / programs / imagex.c
index b16579e74090782e7a50052dea7a02d563ce9cc6..d6d261710f4e0e6adbba0086986d506ceabe71d0 100644 (file)
@@ -348,7 +348,7 @@ enum {
 /*
  * Parses a filename in the source list file format.  (See the man page for
  * 'imagex capture' for details on this format and the meaning.)  Accepted
- * formats for filenames are an unquoted string, whitespace-delimited, or a
+ * formats for filenames are an unquoted string (whitespace-delimited), or a
  * double or single-quoted string.
  *
  * @line_p:  Pointer to the pointer to the line of data.  Will be updated
@@ -494,7 +494,9 @@ parse_source_list(char *source_list_contents, size_t source_list_nbytes,
        p = source_list_contents;
        j = 0;
        for (i = 0; i < nlines; i++) {
-               char *endp = strchr(p, '\n');
+               /* XXX: Could use rawmemchr() here instead, but it may not be
+                * available on all platforms. */
+               char *endp = memchr(p, '\n', source_list_nbytes);
                size_t len = endp - p + 1;
                *endp = '\0';
                if (!is_comment_line(p, len)) {
@@ -2122,14 +2124,14 @@ int main(int argc, char **argv)
        for_imagex_command(cmd) {
                if (strcmp(cmd->name, *argv) == 0) {
                        ret = cmd->func(argc, argv);
-                       goto out;
+                       goto out_check_write_error;
                }
        }
 
        imagex_error("Unrecognized command: `%s'", argv[0]);
        usage_all();
        return 1;
-out:
+out_check_write_error:
        /* For 'imagex info' and 'imagex dir', data printed to standard output
         * is part of the program's actual behavior and not just for
         * informational purposes, so we should set a failure exit status if
@@ -2141,7 +2143,7 @@ out:
                                ret = -1;
                }
        }
-
+out:
        /* Exit status (ret):  -1 indicates an error found by 'imagex' outside
         * of the wimlib library code.  0 indicates success.  > 0 indicates a
         * wimlib error code from which an error message can be printed. */