hal: Branch 'master'

Martin Pitt martin at kemper.freedesktop.org
Wed Jul 14 21:55:24 PDT 2010


 tools/hal-storage-mount.c  |    3 +++
 tools/hal-storage-shared.c |    9 ++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 7523710dde7479e6854e172b5810ffea84be58bf
Author: Martin Pitt <martin.pitt at ubuntu.com>
Date:   Thu Jul 15 06:53:33 2010 +0200

    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!

diff --git a/tools/hal-storage-mount.c b/tools/hal-storage-mount.c
index c543707..3ecea02 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 e7e2825..e5373be 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");


More information about the hal-commit mailing list