On 30 April 2013 13:16, Glauber Costa <[email protected]> wrote:
> @@ -576,7 +765,9 @@ int ct_do_open(vps_handler *h, vps_param *param)
> {
> int ret;
> char path[STR_SIZE];
> + char upath[STR_SIZE];
> struct stat st;
> + unsigned long *local_uid = param->res.misc.local_uid;
>
> ret = container_init();
> if (ret) {
> @@ -592,6 +783,9 @@ int ct_do_open(vps_handler *h, vps_param *param)
> if (snprintf(path, sizeof(path), "/proc/%d/ns/pid", getpid()) < 0)
> return VZ_RESOURCE_ERROR;
>
> + if (snprintf(upath, sizeof(upath), "/proc/%d/ns/user", getpid()) < 0)
> + return VZ_RESOURCE_ERROR;
> +
It might have sense to compare return code not with 0, but
sizeof(upath), since "... The functions snprintf() and vsnprintf() do
not write more than size bytes (including the terminating null byte
('\0')). If the output was truncated due to this limit then the return
value is the number of characters (excluding the terminating null
byte) which would have been written to the final string if enough
space had been available. Thus, a return value of size or more means
that the output was truncated. ..."
--
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel