From: Christian Brauner Date: Mon, 27 Sep 2021 10:03:20 +0000 (+0200) Subject: lxc-monitord: use {} around ; X-Git-Tag: lxc-4.0.11~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7efc949d8ed7285fac01a6f6fb10c04b4fbee1a0;p=thirdparty%2Flxc.git lxc-monitord: use {} around ; Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cmd/lxc_monitord.c b/src/lxc/cmd/lxc_monitord.c index 16a500610..ef90d63ed 100644 --- a/src/lxc/cmd/lxc_monitord.c +++ b/src/lxc/cmd/lxc_monitord.c @@ -397,15 +397,18 @@ int main(int argc, char *argv[]) goto on_error; monitord_created = true; - /* sync with parent, we're ignoring the return from write - * because regardless if it works or not, the following - * close will sync us with the parent process. the - * if-empty-statement construct is to quiet the - * warn-unused-result warning. - */ - if (lxc_write_nointr(pipefd, "S", 1)) - ; - close(pipefd); + if (pipefd != -1) { + /* sync with parent, we're ignoring the return from write + * because regardless if it works or not, the following + * close will sync us with the parent process. the + * if-empty-statement construct is to quiet the + * warn-unused-result warning. + */ + if (lxc_write_nointr(pipefd, "S", 1)) { + ; + } + close(pipefd); + } if (lxc_monitord_mainloop_add(&monitor)) { ERROR("Failed to add mainloop handlers");