Skip to content
Snippets Groups Projects
Commit ccea25f1 authored by Michael Tokarev's avatar Michael Tokarev
Browse files

os-posix: replace goto again with a proper loop


Eliminiate two fullwrite implementations with goto replacing them with
a proper do..while loop.

Signed-off-by: default avatarMichael Tokarev <mjt@tls.msk.ru>
Reviewed-by: default avatarGonglei <arei.gonglei@huawei.com>
parent 0be5e436
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment