|
From: Nicholas N. <nj...@cs...> - 2005-05-15 16:25:27
|
On Tue, 10 May 2005, Nicholas Nethercote wrote: > In vg_main.c:process_cmd_line_options(), around line 1856, there's a switch > on VG_(clo_log_to). In the File/FileExactly cases, VG_(safe_fd)() > is called on the resulting file descriptors. In the Socket case, it's not > called. > > Then around line 1957, 7 lines of code are executed that moves fd into a safe > range. This looks almost identical to what VG_(safe_fd)() is doing. One > difference is that it doesn't close the fd if the DUPFD operation fails. > (VG_(safe_fd)() does close it in that case). However, the close() is pretty > pointless since VG_(safe_fd)() asserts shortly after in the failure case, > whereas the 7 lines don't. > > So, some questions: > > - can the VG_(safe_fd)() calls be removed from the switch, since the > post-switch 7 linrd do basically the same thing? > > - about VG_(safe_fd)() itself: is it appropriate that if the DUPFD ever > fails it will die with an assertion failure? > > - can we call VG_(safe_fd)() in the post-switch code rather than having > those 7 lines? Currently those lines just print out a warning and > continue if the DUPFD fails -- perhaps aborting would be better? I just committed a change that affects CLOs, but I preserved the current behaviour, even though I'm not convinced it's appropriate. If anyone has any further comments I'd appreciate it. N |