[PVFS-developers] Manager unable to open log file
Stuart White
stuart_white1 at yahoo.com
Fri Jul 30 06:44:24 EDT 2004
In mgr.c, code exists that opens the log file. (line 365 in
1.6.3-pre2)
if ((logfd = open(logname, logflags, 0700)) == -1) {
#endif
ERR("couldn't create logfile...continuing...\n");
close(0); close(1); close(2);
}
If the open() of the log file fails, stdin, stdout, and stderr are
closed, and then execution simply continues.
This seems dangerous to me. Because stdout and stderr are closed,
their file descriptors will be re-used when opening metadata files.
Lots of debugging code exists in the manager that fprintf's to stderr.
If stderr's file descriptor has been recycled and used for a metadata
file, these debug fprintf's will corrupt the contents of the metadata
files.
In my version of PVFS, I changed this case to simply error out if the
open() of the log file failed. However, I'm not submitting a patch for
that because, it seems this is a judgement call for how one wants to
handle this situation. Another option would be to open /dev/null and
call dup2() redirecting stdout and stderr to /dev/null.
In any case, it seems something different should be done. I ask you
guys to take a look at this and implement whatever correction you deem
appropriate.
As always, feedback is appreciated! Thanks!
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
More information about the PVFS-developers
mailing list