summaryrefslogtreecommitdiff
path: root/sdcard
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2012-08-15 09:54:30 -0700
committerJean-Baptiste Queru <jbq@google.com>2012-08-15 10:01:12 -0700
commite92372ba9eaa04eb4ed7eb9417ee2be3515bd972 (patch)
tree043d28472868bd938ce7e0fa423dfe1ea1cf463d /sdcard
parentd7f78e88b5b2c65b8cef21fdcaae3278ec2ed083 (diff)
parent2237ca4c6658d73c9fd21cb2fa10eeddff5708da (diff)
resolved conflicts for merge of 2237ca4c to jb-mr1-dev
Change-Id: I04982ff2b092274b940a621b238c2246349aa85e
Diffstat (limited to 'sdcard')
-rw-r--r--sdcard/sdcard.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/sdcard/sdcard.c b/sdcard/sdcard.c
index 877a52412..8d87ee92d 100644
--- a/sdcard/sdcard.c
+++ b/sdcard/sdcard.c
@@ -1314,11 +1314,23 @@ int main(int argc, char **argv)
source_path = arg;
else if (!dest_path)
dest_path = arg;
- else if (!uid)
- uid = strtoul(arg, 0, 10);
- else if (!gid)
- gid = strtoul(arg, 0, 10);
- else {
+ else if (!uid) {
+ char* endptr = NULL;
+ errno = 0;
+ uid = strtoul(arg, &endptr, 10);
+ if (*endptr != '\0' || errno != 0) {
+ ERROR("Invalid uid");
+ return usage();
+ }
+ } else if (!gid) {
+ char* endptr = NULL;
+ errno = 0;
+ gid = strtoul(arg, &endptr, 10);
+ if (*endptr != '\0' || errno != 0) {
+ ERROR("Invalid gid");
+ return usage();
+ }
+ } else {
ERROR("too many arguments\n");
return usage();
}