]> git.tdb.fi Git - pmount-gui.git/commitdiff
More efficient way to recognize removable buses
authorMikko Rasa <tdb@tdb.fi>
Sat, 19 Apr 2014 17:30:40 +0000 (20:30 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 19 Apr 2014 17:30:40 +0000 (20:30 +0300)
main.c

diff --git a/main.c b/main.c
index 2609341f6c870eef728bd6e08f966958fa460baa..d1a2853c48dcb4d512cd78623893e3e449c06dd7 100644 (file)
--- a/main.c
+++ b/main.c
@@ -313,7 +313,7 @@ int can_mount(Property *props, char **allowed)
        static char *removable_buses[] = { "usb", "firewire", 0 };
        char *devname;
        char *devpath;
        static char *removable_buses[] = { "usb", "firewire", 0 };
        char *devname;
        char *devpath;
-       int i;
+       char *bus;
 
        devname = get_property_value(props, "DEVNAME");
        if(is_in_array(allowed, devname))
 
        devname = get_property_value(props, "DEVNAME");
        if(is_in_array(allowed, devname))
@@ -326,9 +326,9 @@ int can_mount(Property *props, char **allowed)
        if(is_removable(devpath))
                return 1;
 
        if(is_removable(devpath))
                return 1;
 
-       for(i=0; removable_buses[i]; ++i)
-               if(match_property_value(props, "ID_BUS", removable_buses[i]))
-                       return 1;
+       bus = get_property_value(props, "ID_BUS");
+       if(is_in_array(removable_buses, bus))
+               return 1;
 
        return check_buses(devpath, removable_buses);
 }
 
        return check_buses(devpath, removable_buses);
 }