LibtraceTeam / wandio

C library for simple and efficient file IO
GNU Lesser General Public License v3.0
17 stars 13 forks source link

posix_memalign doesn't return -1 on error #21

Closed isomer closed 5 years ago

isomer commented 5 years ago

posix_memalign returns +errno on error, not -1 or -errno, and ior_peak directly returns the return value of posix_memalign, causing the calling function to believe that some data was returned, instead of an IO error.

Reproduction steps:

bash -c 'ulimit -Sv $[ 64 << 10 ]; wandiocat /etc/motd'

Fix: Line ~115 of ior-peak.c should have errno = ret; return -1; instead of return ret;

salcock commented 5 years ago

Should be fixed in 73d72ed4dbdc25a1ba1140cb2cacb48dcfd831e9.