gspawn: Rewrite some retry loops to use while rather than goto

This introduces no functional changes, but does make the code easier to
understand.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2019-09-26 14:10:36 +01:00
parent 8af823c8e5
commit eae72c3597

View File

@ -1131,10 +1131,9 @@ sane_close (gint fd)
{ {
gint ret; gint ret;
retry: do
ret = close (fd); ret = close (fd);
if (ret < 0 && errno == EINTR) while (ret < 0 && errno == EINTR);
goto retry;
return ret; return ret;
} }
@ -1296,10 +1295,9 @@ sane_dup2 (gint fd1, gint fd2)
{ {
gint ret; gint ret;
retry: do
ret = dup2 (fd1, fd2); ret = dup2 (fd1, fd2);
if (ret < 0 && errno == EINTR) while (ret < 0 && errno == EINTR);
goto retry;
return ret; return ret;
} }
@ -1309,10 +1307,9 @@ sane_open (const char *path, gint mode)
{ {
gint ret; gint ret;
retry: do
ret = open (path, mode); ret = open (path, mode);
if (ret < 0 && errno == EINTR) while (ret < 0 && errno == EINTR);
goto retry;
return ret; return ret;
} }