summaryrefslogtreecommitdiffstats
path: root/logwrapper
diff options
context:
space:
mode:
authorRom Lemarchand <romlem@google.com>2013-03-11 13:19:17 -0700
committerRom Lemarchand <romlem@google.com>2013-03-12 08:55:38 -0700
commit451dd85fb204b5015c461eabc78722abd1c4252a (patch)
treef6bc48e94b705e122eff7a537e2b703c83587042 /logwrapper
parent7398664de30cf953b791ab5aeeb37dfd57410698 (diff)
downloadsystem_core-451dd85fb204b5015c461eabc78722abd1c4252a.zip
system_core-451dd85fb204b5015c461eabc78722abd1c4252a.tar.gz
system_core-451dd85fb204b5015c461eabc78722abd1c4252a.tar.bz2
liblogwrap: replace loops with calls to TEMP_FAILURE_RETRY
Makes the code slightly more readable and avoids boilerplate. Change-Id: I023d9a1e1de729deaec97c62a5ca7983b6918f94
Diffstat (limited to 'logwrapper')
-rw-r--r--logwrapper/logwrap.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/logwrapper/logwrap.c b/logwrapper/logwrap.c
index d9247ec..b2abfe2 100644
--- a/logwrapper/logwrap.c
+++ b/logwrapper/logwrap.c
@@ -79,9 +79,7 @@ static int parent(const char *tag, int parent_read, int signal_fd, pid_t pid,
pthread_sigmask(SIG_UNBLOCK, &chldset, NULL);
while (!found_child) {
- if (poll(poll_fds, remote_hung ? 1 : 2, -1) < 0) {
- if (errno == EINTR)
- continue;
+ if (TEMP_FAILURE_RETRY(poll(poll_fds, remote_hung ? 1 : 2, -1)) < 0) {
ERROR("poll failed\n");
rc = -1;
goto err_poll;
@@ -132,9 +130,7 @@ static int parent(const char *tag, int parent_read, int signal_fd, pid_t pid,
read(signal_fd, tmp, sizeof(tmp));
while (!found_child) {
- do {
- ret = waitpid(-1, &status, WNOHANG);
- } while (ret < 0 && errno == EINTR);
+ ret = TEMP_FAILURE_RETRY(waitpid(-1, &status, WNOHANG));
if (ret <= 0)
break;