summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2010-07-15 06:53:33 +0200
committerMartin Pitt <martin.pitt@ubuntu.com>2010-07-15 06:54:56 +0200
commit7523710dde7479e6854e172b5810ffea84be58bf (patch)
treeb64b8d637fa81ef6a74d42c9e6063393dd1d2836
parent18a43206d2f3c1664d853566b2a264dc756ada7e (diff)
flush hal-mtab before syncing
Commit 476dd36 was incomplete: we need to flush the fd before we sync it, to really have an effect. Thanks to Fujii Takafumi for pointing this out!
-rw-r--r--tools/hal-storage-mount.c3
-rw-r--r--tools/hal-storage-shared.c9
2 files changed, 9 insertions, 3 deletions
diff --git a/tools/hal-storage-mount.c b/tools/hal-storage-mount.c
index c543707c..3ecea02c 100644
--- a/tools/hal-storage-mount.c
+++ b/tools/hal-storage-mount.c
@@ -953,6 +953,9 @@ handle_mount (LibHalContext *hal_ctx,
if (fwrite (hal_mtab_buf, 1, strlen (hal_mtab_buf), hal_mtab) != strlen (hal_mtab_buf)) {
unknown_error ("Cannot write to /media/.hal-mtab~");
}
+ if (fflush (hal_mtab) < 0) {
+ unknown_error ("Cannot flush /media/.hal-mtab~");
+ }
if (fsync (fileno (hal_mtab)) < 0) {
printf ("WARNING! syncing /media/.hal-mtab~ failed: %s\n", strerror (errno));
}
diff --git a/tools/hal-storage-shared.c b/tools/hal-storage-shared.c
index e7e28257..e5373be2 100644
--- a/tools/hal-storage-shared.c
+++ b/tools/hal-storage-shared.c
@@ -483,9 +483,12 @@ line_found:
}
}
- if (fsync (fileno (hal_mtab_new)) < 0) {
- printf ("WARNING! syncing /media/.hal-mtab~ failed: %s\n", strerror (errno));
- }
+ if (fflush (hal_mtab_new) < 0) {
+ unknown_error ("Cannot flush /media/.hal-mtab~");
+ }
+ if (fsync (fileno (hal_mtab_new)) < 0) {
+ printf ("WARNING! syncing /media/.hal-mtab~ failed: %s\n", strerror (errno));
+ }
#ifdef DEBUG
else
printf ("fsync /media/.hal-mtab~: success\n");