[gvfs/gnome-3-26] monitor: Remove device file checks



commit 9bf86aaf229ecbf82777958d55e29ec0d3a2f273
Author: Ondrej Holy <oholy redhat com>
Date:   Tue Oct 31 17:31:05 2017 +0100

    monitor: Remove device file checks
    
    The device file checks were added by mistake and it is not clear whether
    it can't have some side-effect. Let's remove them and use g_strcmp0 for
    sysfs path comparison for sure...
    
    https://bugzilla.gnome.org/show_bug.cgi?id=789491

 monitor/gphoto2/ggphoto2volume.c        |    2 +-
 monitor/gphoto2/ggphoto2volumemonitor.c |    2 +-
 monitor/mtp/gmtpvolume.c                |    2 +-
 monitor/mtp/gmtpvolumemonitor.c         |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/monitor/gphoto2/ggphoto2volume.c b/monitor/gphoto2/ggphoto2volume.c
index c1be77e..21e318b 100644
--- a/monitor/gphoto2/ggphoto2volume.c
+++ b/monitor/gphoto2/ggphoto2volume.c
@@ -218,7 +218,7 @@ g_gphoto2_volume_has_path (GGPhoto2Volume  *volume,
   G_LOCK (gphoto2_volume);
   res = FALSE;
   if (gphoto2_volume->device != NULL)
-    res = strcmp (g_udev_device_get_sysfs_path   (gphoto2_volume->device), sysfs_path) == 0;
+    res = g_strcmp0 (g_udev_device_get_sysfs_path (gphoto2_volume->device), sysfs_path) == 0;
   G_UNLOCK (gphoto2_volume);
   return res;
 }
diff --git a/monitor/gphoto2/ggphoto2volumemonitor.c b/monitor/gphoto2/ggphoto2volumemonitor.c
index 06e07ab..83340a2 100644
--- a/monitor/gphoto2/ggphoto2volumemonitor.c
+++ b/monitor/gphoto2/ggphoto2volumemonitor.c
@@ -248,7 +248,7 @@ on_uevent (GUdevClient *client,
 
   if (g_strcmp0 (action, "add") == 0 && g_udev_device_has_property (device, "ID_GPHOTO2"))
     gudev_add_camera (monitor, device, TRUE);
-  else if (g_strcmp0 (action, "remove") == 0 && g_udev_device_get_device_file (device) != NULL)
+  else if (g_strcmp0 (action, "remove") == 0)
     gudev_remove_camera (monitor, device);
   else
     g_debug ("on_uevent: discarding");
diff --git a/monitor/mtp/gmtpvolume.c b/monitor/mtp/gmtpvolume.c
index cfd7759..681029f 100644
--- a/monitor/mtp/gmtpvolume.c
+++ b/monitor/mtp/gmtpvolume.c
@@ -209,7 +209,7 @@ g_mtp_volume_has_path (GMtpVolume  *volume,
   G_LOCK (mtp_volume);
   res = FALSE;
   if (mtp_volume->device != NULL)
-    res = strcmp (g_udev_device_get_sysfs_path (mtp_volume->device), sysfs_path) == 0;
+    res = g_strcmp0 (g_udev_device_get_sysfs_path (mtp_volume->device), sysfs_path) == 0;
   G_UNLOCK (mtp_volume);
   return res;
 }
diff --git a/monitor/mtp/gmtpvolumemonitor.c b/monitor/mtp/gmtpvolumemonitor.c
index bfd9e29..1e73db7 100644
--- a/monitor/mtp/gmtpvolumemonitor.c
+++ b/monitor/mtp/gmtpvolumemonitor.c
@@ -210,7 +210,7 @@ on_uevent (GUdevClient *client, gchar *action, GUdevDevice *device, gpointer use
 
   if (g_strcmp0 (action, "add") == 0 && g_udev_device_has_property (device, "ID_MTP_DEVICE"))
     gudev_add_device (monitor, device, TRUE);
-  else if (g_strcmp0 (action, "remove") == 0 && g_udev_device_get_device_file (device) != NULL)
+  else if (g_strcmp0 (action, "remove") == 0)
     gudev_remove_device (monitor, device);
   else
     g_debug ("on_uevent: discarding");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]