[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-trivial] [PATCH 2/4] os-posix: replace goto again with a proper lo
From: |
Michael Tokarev |
Subject: |
[Qemu-trivial] [PATCH 2/4] os-posix: replace goto again with a proper loop |
Date: |
Thu, 30 Oct 2014 18:07:15 +0300 |
Elminiate two fullwrite implementations with goto replacing them with
a proper do..while loop.
Signed-off-by: Michael Tokarev <address@hidden>
---
os-posix.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/os-posix.c b/os-posix.c
index d687896..eada8d4 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -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);
}
--
1.7.10.4
- Re: [Qemu-trivial] [PATCH 3/4] pidfile: stop making pidfile error a special case, (continued)
- Re: [Qemu-trivial] [PATCH 3/4] pidfile: stop making pidfile error a special case, Michael Tokarev, 2014/10/31
- Re: [Qemu-trivial] [PATCH 3/4] pidfile: stop making pidfile error a special case, Gonglei, 2014/10/31
- Re: [Qemu-trivial] [PATCH 3/4] pidfile: stop making pidfile error a special case, Michael Tokarev, 2014/10/31
- Re: [Qemu-trivial] [PATCH 3/4] pidfile: stop making pidfile error a special case, Gonglei, 2014/10/31
- Re: [Qemu-trivial] [PATCH 3/4] pidfile: stop making pidfile error a special case, Michael Tokarev, 2014/10/31
- Re: [Qemu-trivial] [PATCH 3/4] pidfile: stop making pidfile error a special case, Gonglei, 2014/10/31
[Qemu-trivial] [PATCH 1/4] os-posix: use global daemon_pipe instead of cryptic fds[1], Michael Tokarev, 2014/10/31
[Qemu-trivial] [PATCH 4/4] os-posix: reorder parent notification for -daemonize, Michael Tokarev, 2014/10/31
[Qemu-trivial] [PATCH 2/4] os-posix: replace goto again with a proper loop,
Michael Tokarev <=