diff options
author | Lukas Larsson <[email protected]> | 2016-09-05 17:24:40 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2016-09-05 17:24:40 +0200 |
commit | 2c9f81b8b030062fb7cbfc4250b2069f73e57cc8 (patch) | |
tree | 4606153d4a28cace9f2a0c8c1602a235c06ea553 /erts/emulator/sys/unix/sys.c | |
parent | bb8d105fd6d5b09097dc64b341d63f0f8d7e8906 (diff) | |
parent | 7c5f497ab6f4b145554ee884e9fa0ec86246e9ee (diff) | |
download | otp-2c9f81b8b030062fb7cbfc4250b2069f73e57cc8.tar.gz otp-2c9f81b8b030062fb7cbfc4250b2069f73e57cc8.tar.bz2 otp-2c9f81b8b030062fb7cbfc4250b2069f73e57cc8.zip |
Merge branch 'lukas/erts/fix_signalhandler_errno_restore/OTP-13868' into maint
* lukas/erts/fix_signalhandler_errno_restore/OTP-13868:
erts: Fix child setup signal hander bug
Diffstat (limited to 'erts/emulator/sys/unix/sys.c')
-rw-r--r-- | erts/emulator/sys/unix/sys.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c index 6fb86f6dda..089efec3e8 100644 --- a/erts/emulator/sys/unix/sys.c +++ b/erts/emulator/sys/unix/sys.c @@ -715,11 +715,13 @@ static RETSIGTYPE suspend_signal(void) static RETSIGTYPE suspend_signal(int signum) #endif { - int res; - int buf[1]; - do { - res = read(sig_suspend_fds[0], buf, sizeof(int)); - } while (res < 0 && errno == EINTR); + int res, buf[1], __errno = errno; + do { + res = read(sig_suspend_fds[0], buf, sizeof(int)); + } while (res < 0 && errno == EINTR); + + /* restore previous errno in case read changed it */ + errno = __errno; } #endif /* #ifdef ERTS_SYS_SUSPEND_SIGNAL */ |