aboutsummaryrefslogtreecommitdiffstats
path: root/libarchive/archive_write_set_format_xar.c
diff options
context:
space:
mode:
Diffstat (limited to 'libarchive/archive_write_set_format_xar.c')
-rw-r--r--libarchive/archive_write_set_format_xar.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libarchive/archive_write_set_format_xar.c b/libarchive/archive_write_set_format_xar.c
index 36d4a615e2ae..5e4b90e06b3f 100644
--- a/libarchive/archive_write_set_format_xar.c
+++ b/libarchive/archive_write_set_format_xar.c
@@ -496,10 +496,13 @@ xar_options(struct archive_write *a, const char *key, const char *value)
return (ARCHIVE_OK);
}
if (strcmp(key, "threads") == 0) {
+ char *endptr;
+
if (value == NULL)
return (ARCHIVE_FAILED);
- xar->opt_threads = (int)strtoul(value, NULL, 10);
- if (xar->opt_threads == 0 && errno != 0) {
+ errno = 0;
+ xar->opt_threads = (int)strtoul(value, &endptr, 10);
+ if (errno != 0 || *endptr != '\0') {
xar->opt_threads = 1;
archive_set_error(&(a->archive),
ARCHIVE_ERRNO_MISC,