From: Michel Normand Date: Mon, 18 May 2009 20:27:35 +0000 (+0200) Subject: correct error reporting for lxc_setstate X-Git-Tag: lxc_0_6_3~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4072342e0b6f1d9ce40fa8e6ecaad60be9ddd78;p=thirdparty%2Flxc.git correct error reporting for lxc_setstate there was a missing init of local variable Signed-off-by: Daniel Lezcano Signed-off-by: Michel Normand --- diff --git a/src/lxc/state.c b/src/lxc/state.c index 0fad79279..511b1bfe1 100644 --- a/src/lxc/state.c +++ b/src/lxc/state.c @@ -62,19 +62,19 @@ lxc_state_t lxc_str2state(const char *state) int lxc_setstate(const char *name, lxc_state_t state) { - int fd, err; + int fd, err = -1; char file[MAXPATHLEN]; const char *str = lxc_state2str(state); if (!str) - return -1; + return err; snprintf(file, MAXPATHLEN, LXCPATH "/%s/state", name); fd = open(file, O_WRONLY); if (fd < 0) { SYSERROR("failed to open %s file", file); - return -1; + return err; } if (flock(fd, LOCK_EX)) { @@ -98,7 +98,7 @@ out: lxc_monitor_send_state(name, state); - return -err; + return err; } int lxc_mkstate(const char *name)