aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/unix')
-rw-r--r--src/os/unix/ngx_errno.h14
-rw-r--r--src/os/unix/ngx_process.c11
2 files changed, 19 insertions, 6 deletions
diff --git a/src/os/unix/ngx_errno.h b/src/os/unix/ngx_errno.h
index 379f36777..ddc2b2761 100644
--- a/src/os/unix/ngx_errno.h
+++ b/src/os/unix/ngx_errno.h
@@ -64,10 +64,22 @@ u_char *ngx_strerror_r(int err, u_char *errstr, size_t size);
/* Solaris and Tru64 UNIX have thread-safe strerror() */
-#define ngx_strerror_r(err, errstr, size) \
+#define ngx_strerror_r(err, errstr, size) \
ngx_cpystrn(errstr, (u_char *) strerror(err), size)
#endif
+#if (NGX_HAVE_SYS_ERRLIST)
+
+#define ngx_sigsafe_strerror(err) \
+ (err > 0 && err < sys_nerr) ? sys_errlist[err] : "Unknown error"
+
+#else
+
+#define ngx_sigsafe_strerror(err) ""
+
+#endif
+
+
#endif /* _NGX_ERRNO_H_INCLUDED_ */
diff --git a/src/os/unix/ngx_process.c b/src/os/unix/ngx_process.c
index f140d629b..0d08349ee 100644
--- a/src/os/unix/ngx_process.c
+++ b/src/os/unix/ngx_process.c
@@ -479,16 +479,17 @@ ngx_process_get_status(void)
*/
if (err == NGX_ECHILD) {
- ngx_log_error(NGX_LOG_INFO, ngx_cycle->log, errno,
- "waitpid() failed");
+ ngx_log_error(NGX_LOG_INFO, ngx_cycle->log, 0,
+ "waitpid() failed (%d: %s)",
+ err, ngx_sigsafe_strerror(err));
return;
}
#endif
- ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, errno,
- "waitpid() failed");
-
+ ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
+ "waitpid() failed (%d: %s)",
+ err, ngx_sigsafe_strerror(err));
return;
}