]> git.proxmox.com Git - mirror_lxc.git/commitdiff
tools/lxc_execute: use lxc_safe_uint()
authorChristian Brauner <christian.brauner@canonical.com>
Sat, 29 Oct 2016 10:22:17 +0000 (12:22 +0200)
committerChristian Brauner <christian.brauner@canonical.com>
Tue, 22 Nov 2016 03:46:08 +0000 (04:46 +0100)
Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
src/lxc/tools/lxc_execute.c

index 13fa799527506f546612e3f97e7cd5e74147d7ae..fae2dca0aed27512a3e1e318d7e0083a1f3f2b20 100644 (file)
@@ -58,10 +58,19 @@ static int my_checker(const struct lxc_arguments* args)
 static int my_parser(struct lxc_arguments* args, int c, char* arg)
 {
        switch (c) {
-       case 'f': args->rcfile = arg; break;
-       case 's': return lxc_config_define_add(&defines, arg); break;
-       case 'u': args->uid = atoi(arg); break;
-       case 'g': args->gid = atoi(arg);
+       case 'f':
+               args->rcfile = arg;
+               break;
+       case 's':
+               return lxc_config_define_add(&defines, arg);
+               break;
+       case 'u':
+               if (lxc_safe_uint(arg, &args->uid) < 0)
+                       return -1;
+               break;
+       case 'g':
+               if (lxc_safe_uint(arg, &args->gid) < 0)
+                       return -1;
        }
        return 0;
 }