]> Dogcows Code - chaz/tar/commitdiff
(atime_decoder,gid_decoder,ctime_decoder)
authorSergey Poznyakoff <gray@gnu.org.ua>
Thu, 13 Nov 2003 08:47:25 +0000 (08:47 +0000)
committerSergey Poznyakoff <gray@gnu.org.ua>
Thu, 13 Nov 2003 08:47:25 +0000 (08:47 +0000)
(mtime_decoder,size_decoder,uid_decoder): Use xstrtoumax.
Fixes "pax-big-10g" bug

src/xheader.c

index 1441eec8728b5e14f4d1f5bdcf74737fcea20586..d5a75b3e32d8678348fca82b7dcdbe37db3751bc 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <hash.h>
 #include <quotearg.h>
+#include <xstrtol.h>
 
 #include "common.h"
 
@@ -290,7 +291,9 @@ atime_coder (struct tar_stat_info const *st, char const *keyword,
 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
@@ -303,7 +306,9 @@ gid_coder (struct tar_stat_info const *st, char const *keyword,
 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
@@ -342,7 +347,9 @@ ctime_coder (struct tar_stat_info const *st, char const *keyword,
 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
@@ -355,7 +362,9 @@ mtime_coder (struct tar_stat_info const *st, char const *keyword,
 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
@@ -383,7 +392,9 @@ size_coder (struct tar_stat_info const *st, char const *keyword,
 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
@@ -396,7 +407,9 @@ uid_coder (struct tar_stat_info const *st, char const *keyword,
 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
This page took 0.024533 seconds and 4 git commands to generate.