diff options
author | Sergio Costas Rodriguez <sergio.costas@canonical.com> | 2022-08-31 15:20:20 +0200 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2023-02-06 14:43:45 +0000 |
commit | a70e9fbdf34768985925b2b81661190a094e718b (patch) | |
tree | 5c54fc14b0b08627846cfe9b4389a2767d8c24e6 | |
parent | c45294a2a7fb975740b44dde5b35f89e0a7cae76 (diff) | |
download | gvfs-a70e9fbdf34768985925b2b81661190a094e718b.tar.gz |
Fix string comparison
In several places, the code compares to strings by comparing
their pointers instead of using g_strcmp0(). Although this
seems to work, it is incorrect.
This MR fixes it.
-rw-r--r-- | client/gdaemonvfs.c | 2 | ||||
-rw-r--r-- | daemon/main.c | 2 | ||||
-rw-r--r-- | daemon/mount.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/client/gdaemonvfs.c b/client/gdaemonvfs.c index bae13eb3..fc439014 100644 --- a/client/gdaemonvfs.c +++ b/client/gdaemonvfs.c @@ -308,7 +308,7 @@ g_daemon_vfs_init (GDaemonVfs *vfs) vfs->wrapped_vfs = g_vfs_get_local (); /* Use the old .gvfs location as fallback, not .cache/gvfs */ - if (g_get_user_runtime_dir() == g_get_user_cache_dir ()) + if (g_strcmp0 (g_get_user_runtime_dir(), g_get_user_cache_dir ()) == 0) file = g_build_filename (g_get_home_dir(), ".gvfs", NULL); else file = g_build_filename (g_get_user_runtime_dir(), "gvfs", NULL); diff --git a/daemon/main.c b/daemon/main.c index ff1c522b..a36c96b4 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -79,7 +79,7 @@ on_name_acquired (GDBusConnection *connection, char *argv2[6]; /* Use the old .gvfs location as fallback, not .cache/gvfs */ - if (g_get_user_runtime_dir() == g_get_user_cache_dir ()) + if (g_strcmp0 (g_get_user_runtime_dir(), g_get_user_cache_dir ()) == 0) fuse_path = g_build_filename (g_get_home_dir(), ".gvfs", NULL); else fuse_path = g_build_filename (g_get_user_runtime_dir (), "gvfs", NULL); diff --git a/daemon/mount.c b/daemon/mount.c index 41a4b0b7..df9c7afa 100644 --- a/daemon/mount.c +++ b/daemon/mount.c @@ -739,7 +739,7 @@ handle_register_mount (GVfsDBusMountTracker *object, if (arg_user_visible) { /* Use the old .gvfs location as fallback, not .cache/gvfs */ - if (g_get_user_runtime_dir() == g_get_user_cache_dir ()) + if (g_strcmp0 (g_get_user_runtime_dir(), g_get_user_cache_dir ()) == 0) mount->fuse_mountpoint = g_build_filename (g_get_home_dir(), ".gvfs", mount->stable_name, NULL); else mount->fuse_mountpoint = g_build_filename (g_get_user_runtime_dir(), "gvfs", mount->stable_name, NULL); |