]> git.proxmox.com Git - mirror_qemu.git/commitdiff
os-posix: replace goto again with a proper loop
authorMichael Tokarev <mjt@tls.msk.ru>
Thu, 30 Oct 2014 14:37:16 +0000 (17:37 +0300)
committerMichael Tokarev <mjt@tls.msk.ru>
Sun, 2 Nov 2014 07:04:34 +0000 (10:04 +0300)
Eliminiate two fullwrite implementations with goto replacing them with
a proper do..while loop.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
os-posix.c

index d687896f91fe884cbb5149aa42a883496c8e03d0..eada8d4685669a3f00bf0eba0860a73137878109 100644 (file)
@@ -218,11 +218,9 @@ void os_daemonize(void)
 
             close(fds[1]);
 
-        again:
-            len = read(fds[0], &status, 1);
-            if (len == -1 && (errno == EINTR)) {
-                goto again;
-            }
+            do {
+                len = read(fds[0], &status, 1);
+            } while (len < 0 && errno == EINTR);
             if (len != 1) {
                 exit(1);
             }
@@ -264,11 +262,9 @@ void os_setup_post(void)
         uint8_t status = 0;
         ssize_t len;
 
-    again1:
-        len = write(daemon_pipe, &status, 1);
-        if (len == -1 && (errno == EINTR)) {
-            goto again1;
-        }
+        do {        
+            len = write(daemon_pipe, &status, 1);
+        } while (len < 0 && errno == EINTR);
         if (len != 1) {
             exit(1);
         }