[vhffs-dev] [1534] well, we need to fflush() before using futimes() ;) |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1534
Author: gradator
Date: 2010-01-09 23:36:16 +0100 (Sat, 09 Jan 2010)
Log Message:
-----------
well, we need to fflush() before using futimes() ;)
Modified Paths:
--------------
trunk/vhffs-fssync/vhffsfssync_slave.c
Modified: trunk/vhffs-fssync/vhffsfssync_slave.c
===================================================================
--- trunk/vhffs-fssync/vhffsfssync_slave.c 2010-01-09 20:48:49 UTC (rev 1533)
+++ trunk/vhffs-fssync/vhffsfssync_slave.c 2010-01-09 22:36:16 UTC (rev 1534)
@@ -47,6 +47,7 @@
#include <netinet/in.h>
#include <getopt.h>
#include <utime.h>
+#include <sys/time.h>
/* -- network stuff -- */
@@ -432,12 +433,17 @@
f = g_hash_table_lookup(conn->openfiles, pathname);
if(f) {
struct timeval tv[2];
+
+ fflush(f);
+
tv[0].tv_sec = (time_t)mtime;
tv[0].tv_usec = 0;
tv[1].tv_sec = (time_t)mtime;
tv[1].tv_usec = 0;
- futimes(fileno(f), &tv[0]);
+ if( futimes(fileno(f), tv) ) {
+ fprintf(stderr, "futimes() failed on %s: %s\n", pathname, strerror(errno));
+ }
}
g_hash_table_remove(conn->openfiles, pathname);
}