mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-22 02:02:10 +01:00
inotify: Don’t propagate unrecognised events to GLocalFileMonitor
If we can’t convert the inotify event mask into a GFileMonitorEvent enum value, don’t propagate it to GLocalFileMonitor, since it hits an assertion failure in that case. This should no longer be possible since the previous commit to ignore IN_Q_OVERFLOW events, but we might as well change this just in case other bugs crop up in event mask handling. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://bugzilla.gnome.org/show_bug.cgi?id=776147
This commit is contained in:
parent
d97e077090
commit
3246f1df99
@ -156,9 +156,12 @@ ih_event_callback (ik_event_t *event,
|
|||||||
gboolean file_event)
|
gboolean file_event)
|
||||||
{
|
{
|
||||||
gboolean interesting;
|
gboolean interesting;
|
||||||
|
GFileMonitorEvent event_flags;
|
||||||
|
|
||||||
g_assert (!file_event); /* XXX hardlink support */
|
g_assert (!file_event); /* XXX hardlink support */
|
||||||
|
|
||||||
|
event_flags = ih_mask_to_EventFlags (event->mask);
|
||||||
|
|
||||||
if (event->mask & IN_MOVE)
|
if (event->mask & IN_MOVE)
|
||||||
{
|
{
|
||||||
/* We either have a rename (in the same directory) or a move
|
/* We either have a rename (in the same directory) or a move
|
||||||
@ -187,17 +190,22 @@ ih_event_callback (ik_event_t *event,
|
|||||||
else
|
else
|
||||||
other = NULL;
|
other = NULL;
|
||||||
|
|
||||||
/* this is either an incoming or outgoing move */
|
/* This is either an incoming or outgoing move. Since we checked the
|
||||||
interesting = g_file_monitor_source_handle_event (sub->user_data, ih_mask_to_EventFlags (event->mask),
|
* event->mask above, it should have converted to a #GFileMonitorEvent
|
||||||
|
* properly. If not, the assumption we have made about event->mask
|
||||||
|
* only ever having a single bit set (apart from IN_ISDIR) is false.
|
||||||
|
* The kernel documentation is lacking here. */
|
||||||
|
g_assert (event_flags != -1);
|
||||||
|
interesting = g_file_monitor_source_handle_event (sub->user_data, event_flags
|
||||||
event->name, NULL, other, event->timestamp);
|
event->name, NULL, other, event->timestamp);
|
||||||
|
|
||||||
if (other)
|
if (other)
|
||||||
g_object_unref (other);
|
g_object_unref (other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (event_flags != -1)
|
||||||
/* unpaired event -- no 'other' field */
|
/* unpaired event -- no 'other' field */
|
||||||
interesting = g_file_monitor_source_handle_event (sub->user_data, ih_mask_to_EventFlags (event->mask),
|
interesting = g_file_monitor_source_handle_event (sub->user_data, event_flags
|
||||||
event->name, NULL, NULL, event->timestamp);
|
event->name, NULL, NULL, event->timestamp);
|
||||||
|
|
||||||
if (event->mask & IN_CREATE)
|
if (event->mask & IN_CREATE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user