Handle errno in angel_fake_log
parent
324224fe2e
commit
bb59776ea3
|
@ -6,7 +6,7 @@
|
|||
/* listen to a socket */
|
||||
LI_API int angel_listen(server *srv, GString *str);
|
||||
|
||||
/* send log messages while startup to angel, frees the string */
|
||||
/* send log messages during startup to angel, frees the string */
|
||||
LI_API gboolean angel_log(server *srv, GString *str);
|
||||
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ int angel_fake_listen(server *srv, GString *str) {
|
|||
}
|
||||
}
|
||||
|
||||
/* send log messages while startup to angel */
|
||||
/* print log messages during startup to stderr */
|
||||
gboolean angel_fake_log(server *srv, GString *str) {
|
||||
const char *buf;
|
||||
guint len;
|
||||
|
@ -92,6 +92,11 @@ gboolean angel_fake_log(server *srv, GString *str) {
|
|||
while (len > 0) {
|
||||
written = write(2, buf, len);
|
||||
if (written < 0) {
|
||||
switch (errno) {
|
||||
case EAGAIN:
|
||||
case EINTR:
|
||||
continue;
|
||||
}
|
||||
g_string_free(str, TRUE);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue