HewlettPackard / netperf

Netperf is a benchmark that can be used to measure the performance of many different types of networking. It provides tests for both unidirectional throughput, and end-to-end latency.
MIT License
859 stars 187 forks source link

netserver: do not chmod("/dev/null", 0644) when suppress_debug==1 #63

Open chenshuo opened 3 years ago

chenshuo commented 3 years ago

When running as root, chmod("/dev/null", 0644) will break most Unix-like systems as "/dev/null" can't be open for write by non-root users anymore.

Before the fix: root@linux# strace -f -e chmod ./netserver Starting netserver with host 'IN(6)ADDR_ANY' port '12865' and family AF_UNSPEC strace: Process 976220 attached [pid 976219] +++ exited with 0 +++ chmod("/dev/null", 0644) = 0

Fixes: 5380b1f5 ("netserver: use mkstemp to create/open debug file")