Author: rfm
Date: Wed May 18 16:09:29 2016
New Revision: 39777
URL: http://svn.gna.org/viewcvs/gnustep?rev=39777&view=rev
Log:
Fix logging error spotted by Wolfgang.
Modified:
libs/ec/trunk/ChangeLog
libs/ec/trunk/EcProcess.m
Modified: libs/ec/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/ChangeLog?rev=39777&r1=39776&r2=39777&view=diff
==============================================================================
--- libs/ec/trunk/ChangeLog (original)
+++ libs/ec/trunk/ChangeLog Wed May 18 16:09:29 2016
@@ -1,3 +1,12 @@
+2016-05-18 Richard Frith-Macdonald <[email protected]>
+
+ * EcProcess.m: When changing log files on a nightly basis, don't
+ close descriptor 2 (stderr). Instead open the new log and use
+ dup2() to switch the new log to be stderr. Wolfgang spotted that
+ the existing code allowed another thread to ned up using the
+ descriptor if it opened a device in the gap between the old log
+ file being closed and the new one opened.
+
2016-01-21 Richard Frith-Macdonald <[email protected]>
* EcAlarm.h:
Modified: libs/ec/trunk/EcProcess.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/EcProcess.m?rev=39777&r1=39776&r2=39777&view=diff
==============================================================================
--- libs/ec/trunk/EcProcess.m (original)
+++ libs/ec/trunk/EcProcess.m Wed May 18 16:09:29 2016
@@ -1515,14 +1515,17 @@
NSDictionary *attr;
NSFileManager *mgr;
- /*
- * Ensure that all data is written to file.
+ /* Ensure that all data is written to file, then close it unless it's
+ * stderr (which we must keep open for logging at all times).
*/
fflush(stderr);
- NS_DURING
- [hdl closeFile];
- NS_HANDLER
- NS_ENDHANDLER
+ if ([hdl fileDescriptor] != 2)
+ {
+ NS_DURING
+ [hdl closeFile];
+ NS_HANDLER
+ NS_ENDHANDLER
+ }
/*
* If the file is empty, remove it, otherwise move to archive directory.
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs