[vhffs-dev] [1375] fixed a bug when a temporary file is used again |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1375
Author: gradator
Date: 2009-03-14 02:56:49 +0100 (Sat, 14 Mar 2009)
Log Message:
-----------
fixed a bug when a temporary file is used again
Modified Paths:
--------------
trunk/vhffs-fssync/vhffsfssync_master.c
Modified: trunk/vhffs-fssync/vhffsfssync_master.c
===================================================================
--- trunk/vhffs-fssync/vhffsfssync_master.c 2009-03-13 16:40:14 UTC (rev 1374)
+++ trunk/vhffs-fssync/vhffsfssync_master.c 2009-03-14 01:56:49 UTC (rev 1375)
@@ -77,8 +77,6 @@
};
static struct vhffsfssync_cookie vhffsfssync_cookie;
-GHashTable *vhffsfssync_missedfiles;
-
// protos
int vhffsfssync_add_watch(int inotifyfd, const char *pathname, uint32_t mask);
int vhffsfssync_modify_watch(int inotifyfd, const char *from, const char *to);
@@ -413,10 +411,8 @@
return -1;
file = vhffsfssync_net_file_open(conn, pathname, "r");
- if(!file) {
- g_hash_table_insert(vhffsfssync_missedfiles, g_strdup(pathname), "");
+ if(!file)
return -1;
- }
// if the file is being sent, cancel it
vhffsfssync_net_remove_file(conn, pathname);
@@ -1272,8 +1268,6 @@
#if DEBUG_INOTIFY
printf("==> REMOVE %s\n", pathname);
#endif
- g_hash_table_remove(vhffsfssync_missedfiles, pathname);
-
if( (_wd = g_hash_table_lookup(vhffsfssync_path_to_wd, pathname)) ) {
vhffsfssync_del_watch(inotifyfd, NULL, *_wd);
}
@@ -1333,7 +1327,6 @@
if(ret < 0) {
if(errno == ENOENT) {
// file already disappeared (common for temporary files)
- g_hash_table_insert(vhffsfssync_missedfiles, g_strdup(pathname), "");
} else {
fprintf(stderr, "cannot readlink() '%s': %s\n", pathname, strerror(errno));
return -1;
@@ -1346,7 +1339,6 @@
else {
if(errno == ENOENT) {
// file already disappeared (common for temporary files)
- g_hash_table_insert(vhffsfssync_missedfiles, g_strdup(pathname), "");
} else {
fprintf(stderr, "cannot lstat() '%s': %s\n", pathname, strerror(errno));
return -1;
@@ -1468,16 +1460,13 @@
#if DEBUG_INOTIFY
printf("==> MOVE %s -> %s (used cookie %d)\n", vhffsfssync_cookie.from, pathname, vhffsfssync_cookie.id);
#endif
- if( vhffsfssync_cookie.isdir )
+ if( vhffsfssync_cookie.isdir ) {
vhffsfssync_modify_watch(inotifyfd, vhffsfssync_cookie.from, pathname);
-
- if(! g_hash_table_lookup(vhffsfssync_missedfiles, vhffsfssync_cookie.from) ) {
vhffsfssync_net_broadcast_event( g_strdup_printf("move%c%s%c%s%c", '\0', vhffsfssync_cookie.from, '\0', pathname, '\0') , VHFFSFSSYNC_NET_PRIO_MEDIUM);
}
else {
vhffsfssync_manage_event_remove(inotifyfd, vhffsfssync_cookie.from);
vhffsfssync_manage_event_create(inotifyfd, pathname, TRUE);
- g_hash_table_remove(vhffsfssync_missedfiles, vhffsfssync_cookie.from);
}
vhffsfssync_cookie.id = 0;
@@ -1640,7 +1629,6 @@
vhffsfssync_path_to_wd = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
vhffsfssync_cookie.id = 0;
vhffsfssync_cookie.from = NULL;
- vhffsfssync_missedfiles = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
inotifyfd = inotify_init();