mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
inotify: Avoid empty root directory string
When gio monitors a directory, it will delete the extra "/" at the end of the directory string, but when the directory is "/", this will cause the modified directory string to be empty, and eventually the monitoring will fail. The solution is to delete only if the directory string length is greater than 1.
This commit is contained in:
parent
548d917f35
commit
2643961845
@ -36,7 +36,7 @@ dup_dirname (const gchar *dirname)
|
||||
gchar *d_dirname = g_strdup (dirname);
|
||||
size_t len = strlen (d_dirname);
|
||||
|
||||
if (d_dirname[len - 1] == '/')
|
||||
if (len > 1 && d_dirname[len - 1] == '/')
|
||||
d_dirname[len - 1] = '\0';
|
||||
|
||||
return d_dirname;
|
||||
|
Loading…
Reference in New Issue
Block a user