Bug 50 - Check fread/fwrite returns values (GCC error with pedantic checking turned on)
: Check fread/fwrite returns values (GCC error with pedantic checking turned on)
Status: RESOLVED FIXED
Product: TORQUE
pbs_mom
: 2.4.x
: PC Linux
: P5 normal
Assigned To: Glen
:
:
:
  Show dependency treegraph
 
Reported: 2010-02-17 08:11 MST by Tobias Burnus
Modified: 2010-06-25 09:37 MDT (History)
2 users (show)

See Also:


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description Tobias Burnus 2010-02-17 08:11:36 MST
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.
Comment 1 David Beer 2010-03-08 14:08:29 MST
The calls to fread has now check the return value.