--- a/src/lxc/tools/lxc_attach.c +++ b/src/lxc/tools/lxc_attach.c @@ -153,6 +153,8 @@ .checker = NULL, .log_priority = "ERROR", .log_file = "none", + .uid = LXC_INVALID_UID, + .gid = LXC_INVALID_GID, }; static int my_parser(struct lxc_arguments *args, int c, char *arg) @@ -366,10 +368,10 @@ goto out; } - if (my_args.uid) + if (my_args.uid != LXC_INVALID_UID) attach_options.uid = my_args.uid; - if (my_args.gid) + if (my_args.gid != LXC_INVALID_GID) attach_options.gid = my_args.gid; if (command.program) { --- a/src/lxc/tools/lxc_execute.c +++ b/src/lxc/tools/lxc_execute.c @@ -84,6 +84,8 @@ .log_priority = "ERROR", .log_file = "none", .daemonize = 0, + .uid = LXC_INVALID_UID, + .gid = LXC_INVALID_GID, }; static int my_parser(struct lxc_arguments *args, int c, char *arg) @@ -211,7 +213,7 @@ if (!bret) goto out; - if (my_args.uid) { + if (my_args.uid != LXC_INVALID_UID) { char buf[256]; ret = snprintf(buf, 256, "%d", my_args.uid); @@ -223,7 +225,7 @@ goto out; } - if (my_args.gid) { + if (my_args.gid != LXC_INVALID_GID) { char buf[256]; ret = snprintf(buf, 256, "%d", my_args.gid);