diff options
author | Andreas Schneider <asn@samba.org> | 2018-09-28 12:55:49 +0200 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2018-10-23 15:39:19 +0200 |
commit | 92891453fb69adb66ea591ed1343c2da821b09d3 (patch) | |
tree | daec4127fdd545cd356ecf5abe0e5b4fc174b0fe /tests/echo_srv.c | |
parent | 326e9f8cd33aeac5d4010910cd32f98b7365bdb7 (diff) | |
download | socket_wrapper-92891453fb69adb66ea591ed1343c2da821b09d3.tar.gz socket_wrapper-92891453fb69adb66ea591ed1343c2da821b09d3.tar.xz socket_wrapper-92891453fb69adb66ea591ed1343c2da821b09d3.zip |
echo_srv: Do not close bogus file descriptors
==1564== Warning: invalid file descriptor 1048564 in syscall close()
==1564== at 0x4D18534: close (in /lib64/libc-2.27.so)
==1564== by 0x4046A74: libc_close (socket_wrapper.c:760)
==1564== by 0x405105C: swrap_close (socket_wrapper.c:5933)
==1564== by 0x40511F5: close (socket_wrapper.c:5979)
==1564== by 0x401679: become_daemon (echo_srv.c:202)
==1564== by 0x402D44: main (echo_srv.c:896)
==1563==
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'tests/echo_srv.c')
-rw-r--r-- | tests/echo_srv.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/tests/echo_srv.c b/tests/echo_srv.c index b97c375..d2f3967 100644 --- a/tests/echo_srv.c +++ b/tests/echo_srv.c @@ -198,11 +198,9 @@ static int become_daemon(void) return ret; } - for (fd = getdtablesize(); fd >= 0; --fd) { - close(fd); - } - for (i = 0; i < 3; i++) { + close(i); + fd = open("/dev/null", O_RDWR, 0); if (fd < 0) { fd = open("/dev/null", O_WRONLY, 0); |