From: Qiang Huang Date: Tue, 24 Sep 2013 07:27:55 +0000 (+0800) Subject: arguments: remove trailing slashes for the input lxcpath X-Git-Tag: lxc-1.0.0.alpha2~98 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e555005b15a1d8e95997bd2d72abd0bc230a541d;p=thirdparty%2Flxc.git arguments: remove trailing slashes for the input lxcpath In lxc_cmd(), we use snprintf(path, len, "%s/%s/command", lxcpath ? lxcpath : inpath, name); to fill sock name, this assume lxcpath have no trailing slashes, so if we use lxc-info -n test -P /usr/local/var/lib/lxc_anon/ to get a running container's state, we will get state: STOPPED which is wrong, because we combine a wrong sock name. To fix this, just remove trailing slashes when parsing arguments. Signed-off-by: Qiang Huang Acked-by: Serge Hallyn Signed-off-by: Serge Hallyn --- diff --git a/src/lxc/arguments.c b/src/lxc/arguments.c index c35dfd896..adcf8fede 100644 --- a/src/lxc/arguments.c +++ b/src/lxc/arguments.c @@ -197,6 +197,7 @@ extern int lxc_arguments_parse(struct lxc_arguments *args, case 'l': args->log_priority = optarg; break; case 'q': args->quiet = 1; break; case 'P': + remove_trailing_slashes(optarg); ret = lxc_arguments_lxcpath_add(args, optarg); if (ret < 0) return ret;