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>
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);
}
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);
}