From: Christian Brauner Date: Mon, 9 Apr 2018 18:44:14 +0000 (+0200) Subject: lxc init: coding style X-Git-Tag: lxc-2.0.10~175 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1fee633e962e20f47c2a15e79dbbaf52d46388b7;p=thirdparty%2Flxc.git lxc init: coding style Signed-off-by: Christian Brauner --- diff --git a/src/lxc/lxc_init.c b/src/lxc/lxc_init.c index dd3c77140..d035257be 100644 --- a/src/lxc/lxc_init.c +++ b/src/lxc/lxc_init.c @@ -97,7 +97,6 @@ static struct arguments my_args = { static void prevent_forking(void) { FILE *f; - int fd = -1; size_t len = 0; char *line = NULL; char path[MAXPATHLEN]; @@ -107,7 +106,7 @@ static void prevent_forking(void) return; while (getline(&line, &len, f) != -1) { - int ret; + int fd, ret; char *p, *p2; p = strchr(line, ':'); @@ -143,7 +142,8 @@ static void prevent_forking(void) goto on_error; } - if (write(fd, "1", 1) != 1) + ret = write(fd, "1", 1); + if (ret != 1) SYSERROR("Failed to write to \"%s\"", path); close(fd);