[mythtv] [PATCH] one-liner to force sync of log in backend

Geoffrey Hausheer ou401cru02 at sneakemail.com
Tue Sep 23 17:55:47 EDT 2003


This is a simple one-liner that opens the logfile in mythbackend with
O_SYNC.  I often find that when mythbackend crashes, the latest log data
hasn't been written to the log file, and it is difficult to figure out
what happened.  This shouldn't cause any issues, since writes to
stderr/stdout should be pretty rare.  I find it useful, but it is no
biggie either way.

.Geoff

Index: programs/mythbackend/main.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythbackend/main.cpp,v
retrieving revision 1.41
diff -u -r1.41 main.cpp
--- programs/mythbackend/main.cpp       17 Sep 2003 16:53:55 -0000     
1.41
+++ programs/mythbackend/main.cpp       23 Sep 2003 21:54:09 -0000
@@ -264,7 +264,7 @@
 
     if (logfile != "")
     {
-        logfd = open(logfile.ascii(), O_WRONLY|O_CREAT|O_APPEND, 0664);
+        logfd = open(logfile.ascii(), O_WRONLY|O_CREAT|O_APPEND|O_SYNC,
0664);
          
         if (logfd < 0)
         {


More information about the mythtv-dev mailing list