Skip to content

Commit

Permalink
cgm_get: support NULL value
Browse files Browse the repository at this point in the history
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
  • Loading branch information
hallyn committed Jan 23, 2014
1 parent bfb1bb9 commit f6639e3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lxc/cgmanager.c
Expand Up @@ -269,6 +269,12 @@ int cgm_get(const char *filename, char *value, size_t len, const char *name, con
}
free(cgroup);
newlen = strlen(result);
if (!value) {
// user queries the size
nih_free(result);
return newlen+1;
}

strncpy(value, result, len);
if (newlen >= len) {
value[len-1] = '\0';
Expand Down

0 comments on commit f6639e3

Please sign in to comment.