[vhffs-dev] [1643] quick fix for a mtime issue at the end of upload

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1643
Author:   gradator
Date:     2010-11-20 20:39:37 +0100 (Sat, 20 Nov 2010)
Log Message:
-----------
quick fix for a mtime issue at the end of upload

Modified Paths:
--------------
    trunk/vhffs-fssync/vhffsfssync_master.c

Modified: trunk/vhffs-fssync/vhffsfssync_master.c
===================================================================
--- trunk/vhffs-fssync/vhffsfssync_master.c	2010-11-18 22:57:16 UTC (rev 1642)
+++ trunk/vhffs-fssync/vhffsfssync_master.c	2010-11-20 19:39:37 UTC (rev 1643)
@@ -453,6 +453,9 @@
 
 void vhffsfssync_net_destroy_file(vhffsfssync_conn *conn, vhffsfssync_net_message_file *filemsg)  {
 
+	struct stat st;
+	time_t mtime;
+
 	conn->messages = g_list_remove(conn->messages, (vhffsfssync_net_message*)filemsg);
 	conn->messages_num--;
 
@@ -466,7 +469,13 @@
 		}
 	}
 
-	vhffsfssync_net_send_event(conn, g_strdup_printf("close%c%s%c%ld%c", '\0', filemsg->file->file_pathname, '\0', filemsg->file->file_stat.st_mtime, '\0') , VHFFSFSSYNC_NET_PRIO_MEDIUM);
+	if( lstat(filemsg->file->file_pathname, &st) < 0 ) {
+		mtime = filemsg->file->file_stat.st_mtime;
+	} else {
+		mtime = st.st_mtime;
+	}
+
+	vhffsfssync_net_send_event(conn, g_strdup_printf("close%c%s%c%ld%c", '\0', filemsg->file->file_pathname, '\0', mtime, '\0') , VHFFSFSSYNC_NET_PRIO_MEDIUM);
 	vhffsfssync_net_file_close(filemsg->file);
 	free(filemsg);
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/