mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 01:58:20 +00:00
GH-1256: Write out strerror when writing errno during safe_write
This commit is contained in:
parent
43821a8957
commit
72ccaee4d5
1 changed files with 6 additions and 2 deletions
|
@ -2165,7 +2165,9 @@ bool safe_write(int fd, const char* data, int len)
|
|||
if ( errno == EINTR )
|
||||
continue;
|
||||
|
||||
fprintf(stderr, "safe_write error: %d\n", errno);
|
||||
char buf[128];
|
||||
zeek_strerror_r(errno, buf, sizeof(buf));
|
||||
fprintf(stderr, "safe_write error: %d (%s)\n", errno, buf);
|
||||
abort();
|
||||
|
||||
return false;
|
||||
|
@ -2189,7 +2191,9 @@ bool safe_pwrite(int fd, const unsigned char* data, size_t len, size_t offset)
|
|||
if ( errno == EINTR )
|
||||
continue;
|
||||
|
||||
fprintf(stderr, "safe_write error: %d\n", errno);
|
||||
char buf[128];
|
||||
zeek_strerror_r(errno, buf, sizeof(buf));
|
||||
fprintf(stderr, "safe_write error: %d (%s)\n", errno, buf);
|
||||
abort();
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue