summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-02-19 13:51:44 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2005-02-19 13:51:44 +0100
commit4871f1188e384b548814d9a898a9429668bc49c7 (patch)
treebc0e22d8a202d587b459b45a058fa59708fe90a7
parent605cd542806849373114419b1c65f8c5d8895c31 (diff)
downloadvdr-4871f1188e384b548814d9a898a9429668bc49c7.tar.gz
vdr-4871f1188e384b548814d9a898a9429668bc49c7.tar.bz2
Replaced the call to system("sync") in SpinUpDisk() with fdatasync(f) to avoid problems on NPTL systems
-rw-r--r--CONTRIBUTORS4
-rw-r--r--HISTORY2
-rw-r--r--tools.c5
3 files changed, 9 insertions, 2 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index cc12503f..56049c1b 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -1275,3 +1275,7 @@ Wolfgang Rohdewald <wolfgang@rohdewald.de>
Chad Flynt <hoochster@sofnet.com>
for suggestions and experiments regarding the buffer reserve in cTransfer
+
+Chris Warren <dvb@ixalon.net>
+ for pointing out that the call to system("sync") in SpinUpDisk() should be
+ replaced with fsync(f) to avoid problems on NPTL systems
diff --git a/HISTORY b/HISTORY
index df11f471..2015f001 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3424,3 +3424,5 @@ Video Disk Recorder Revision History
(thanks to Marco Schlüßler).
- Fixed calling cStatus::MsgChannelSwitch() in cDevice::SetChannel() (thanks to
Marco Schlüßler).
+- Replaced the call to system("sync") in SpinUpDisk() with fdatasync(f) to avoid
+ problems on NPTL systems (thanks to Chris Warren for pointing this out).
diff --git a/tools.c b/tools.c
index 0501d76d..aee71ecf 100644
--- a/tools.c
+++ b/tools.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.c 1.89 2005/02/05 10:10:30 kls Exp $
+ * $Id: tools.c 1.90 2005/02/19 13:43:03 kls Exp $
*/
#include "tools.h"
@@ -454,8 +454,9 @@ bool SpinUpDisk(const char *FileName)
int f = open(buf, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
// O_SYNC doesn't work on all file systems
if (f >= 0) {
+ if (fdatasync(f) < 0)
+ LOG_ERROR_STR(buf);
close(f);
- system("sync");
remove(buf);
gettimeofday(&tp2, NULL);
double seconds = (((long long)tp2.tv_sec * 1000000 + tp2.tv_usec) - ((long long)tp1.tv_sec * 1000000 + tp1.tv_usec)) / 1000000.0;