]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-monitord: use {} around ;
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 27 Sep 2021 10:03:20 +0000 (12:03 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 14 Oct 2021 15:30:09 +0000 (17:30 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cmd/lxc_monitord.c

index 16a5006107d2f3a1972103883339b090b085a53b..ef90d63ed1cc3863118774420181acdabeb65c84 100644 (file)
@@ -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");