tools: fix -g -u parameters for lxc-execute and lxc-attach

Closes #3188. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 2120b89b
......@@ -132,6 +132,8 @@ Options :\n\
.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)
......@@ -345,10 +347,10 @@ int main(int argc, char *argv[])
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) {
......
......@@ -63,6 +63,8 @@ Options :\n\
.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)
......@@ -190,7 +192,7 @@ int main(int argc, char *argv[])
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);
......@@ -202,7 +204,7 @@ int main(int argc, char *argv[])
goto out;
}
if (my_args.gid) {
if (my_args.gid != LXC_INVALID_GID) {
char buf[256];
ret = snprintf(buf, 256, "%d", my_args.gid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment