Bugzilla – Bug 50
Check fread/fwrite returns values (GCC error with pedantic checking turned on)
Last modified: 2010-06-25 09:37:28 MDT
You need to log in before you can comment on or make changes to this bug.
While Torque 2.4.5 fixed: b - updated to a newer gcc and fixed warnings related to disregarded return values. Logging was added. It did not do so for all files; torque-2.4.5/src/resmom/linux/cpuset.c still contains fread (4 times) and fwrite (5 times) without checking for the return value. By the way, the TODO comment in torque-2.4.5/src/resmom/checkpoint.c is now obsolete (occurs twice): /* TODO check return value of fchown */ if (fchown(fd,pjob->ji_qs.ji_un.ji_momt.ji_exuid, pjob->ji_qs.ji_un.ji_momt.ji_exgid)) * * * By the way, rpmlint warns about: libtorque2.x86_64: W: shared-lib-calls-exit /usr/lib64/libtorque.so.2.0.0 exit@GLIBC_2.2.5 This library package calls exit() or _exit(), probably in a non-fork() context. Doing so from a library is strongly discouraged - when a library function calls exit(), it prevents the calling program from handling the error, reporting it to the user, closing files properly, and cleaning up any state that the program has. It is preferred for the library to return an actual error code and let the calling program decide how to handle the situation.
The calls to fread has now check the return value.