Re: [dev] [surf] [patch] Close stdout after printing XID

2012-02-20 Thread Abby Cedar
> And so it becomes a philosophical question. When you close a file descriptor, > it's because you're not going to use it any more. If the programmer > forgets > and writes to stdout anyway, is it better to have the program exit with an > error, or to hide the problem so that nobody discovers the

Re: [dev] [surf] [patch] Close stdout after printing XID

2012-02-19 Thread Abby Cedar
>> Need to close stdout otherwise it can't be used in a script until surf >> finishes. > > Am I missing something?  Why not just use flose(stdout)? Using only fclose would result in Bad file descriptor errors on future attempts to write to stdout. freopen is cleaner.

[dev] [surf] [patch] Close stdout after printing XID

2012-02-18 Thread Abby Cedar
Need to close stdout otherwise it can't be used in a script until surf finishes. To test, try the below before and after the patch. xid=`surf -x &`; echo $xid Patch: --- surf.c.orig    2012-02-19 00:29:24.735959037 +1100 +++ surf.c    2012-02-19 00:37:23.615959945 +1100 @@ -548,6 +548,8 @@