#include <hash.h>
#include <quotearg.h>
+#include <xstrtol.h>
#include "common.h"
static void
atime_decoder (struct tar_stat_info *st, char const *arg)
{
- st->stat.st_atime = strtoul (arg, NULL, 0);
+ uintmax_t u;
+ if (xstrtoumax (arg, 0, 10, &u, "") == LONGINT_OK)
+ st->stat.st_atime = u;
}
static void
static void
gid_decoder (struct tar_stat_info *st, char const *arg)
{
- st->stat.st_gid = strtoul (arg, NULL, 0);
+ uintmax_t u;
+ if (xstrtoumax (arg, 0, 10, &u, "") == LONGINT_OK)
+ st->stat.st_gid = u;
}
static void
static void
ctime_decoder (struct tar_stat_info *st, char const *arg)
{
- st->stat.st_ctime = strtoul (arg, NULL, 0);
+ uintmax_t u;
+ if (xstrtoumax (arg, 0, 10, &u, "") == LONGINT_OK)
+ st->stat.st_ctime = u;
}
static void
static void
mtime_decoder (struct tar_stat_info *st, char const *arg)
{
- st->stat.st_mtime = strtoul (arg, NULL, 0);
+ uintmax_t u;
+ if (xstrtoumax (arg, 0, 10, &u, "") == LONGINT_OK)
+ st->stat.st_mtime = u;
}
static void
static void
size_decoder (struct tar_stat_info *st, char const *arg)
{
- st->stat.st_size = strtoul (arg, NULL, 0);
+ uintmax_t u;
+ if (xstrtoumax (arg, 0, 10, &u, "") == LONGINT_OK)
+ st->stat.st_size = u;
}
static void
static void
uid_decoder (struct tar_stat_info *st, char const *arg)
{
- st->stat.st_uid = strtoul (arg, NULL, 0);
+ uintmax_t u;
+ if (xstrtoumax (arg, 0, 10, &u, "") == LONGINT_OK)
+ st->stat.st_uid = u;
}
static void