Skip to content

Commit

Permalink
coverity: Check return value of setenv
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
  • Loading branch information
stgraber committed Feb 15, 2014
1 parent 1e98542 commit acd4922
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lxc/attach.c
Expand Up @@ -317,8 +317,10 @@ static int lxc_attach_set_environment(enum lxc_attach_env_policy_t policy, char*
if (extra_keep_store) {
size_t i;
for (i = 0; extra_keep[i]; i++) {
if (extra_keep_store[i])
setenv(extra_keep[i], extra_keep_store[i], 1);
if (extra_keep_store[i]) {
if (setenv(extra_keep[i], extra_keep_store[i], 1) < 0)
SYSERROR("Unable to set environment variable");
}
free(extra_keep_store[i]);
}
free(extra_keep_store);
Expand Down

0 comments on commit acd4922

Please sign in to comment.