mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
inotify: Fix handling of paired events for atomic replace
After the big file monitoring rewrite, we only put the IN_MOVED_FROM event in the queue for such pairs. It matches INOTIFY_DIR_MASK and thus we call ip_dispatch_event on it, but that function was filtering it out because the filename in the 'from' event is the one of the temp file, not the one we are monitoring. That name is in the 'to' event, so compare it as well, and let the event passin that case. There is another instance of this check in glocalfilemonitor.c, which is corrected here as well. https://bugzilla.gnome.org/show_bug.cgi?id=751358
This commit is contained in:
parent
780b48c4cd
commit
ac78d14125
@ -344,7 +344,8 @@ g_file_monitor_source_handle_event (GFileMonitorSource *fms,
|
||||
g_assert (!child || is_basename (child));
|
||||
g_assert (!rename_to || is_basename (rename_to));
|
||||
|
||||
if (fms->basename && (!child || !g_str_equal (child, fms->basename)))
|
||||
if (fms->basename && (!child || !g_str_equal (child, fms->basename))
|
||||
&& (!rename_to || !g_str_equal (rename_to, fms->basename)))
|
||||
return TRUE;
|
||||
|
||||
g_mutex_lock (&fms->lock);
|
||||
@ -408,7 +409,6 @@ g_file_monitor_source_handle_event (GFileMonitorSource *fms,
|
||||
|
||||
other = g_local_file_new_from_dirname_and_basename (fms->dirname, rename_to);
|
||||
g_file_monitor_source_file_changes_done (fms, rename_to);
|
||||
g_print ("send %s %s\n", child, g_file_get_path (other));
|
||||
g_file_monitor_source_send_event (fms, G_FILE_MONITOR_EVENT_MOVED, child, other);
|
||||
g_object_unref (other);
|
||||
}
|
||||
|
@ -463,7 +463,8 @@ ip_event_dispatch (GList *dir_list,
|
||||
*/
|
||||
if (sub->filename &&
|
||||
event->name &&
|
||||
strcmp (sub->filename, event->name))
|
||||
strcmp (sub->filename, event->name) &&
|
||||
(!event->pair || !event->pair->name || strcmp (sub->filename, event->pair->name)))
|
||||
continue;
|
||||
|
||||
/* If the subscription has a filename
|
||||
|
Loading…
Reference in New Issue
Block a user