]> git.tdb.fi Git - pmount-gui.git/blobdiff - main.c
Use stat instead of access to check for udevadm presence
[pmount-gui.git] / main.c
diff --git a/main.c b/main.c
index 8f939e60696764d39be3e56558026a779a20d8c5..9172ab6d7b9d049c6c432b063e24c1f82caa2d93 100644 (file)
--- a/main.c
+++ b/main.c
@@ -95,11 +95,12 @@ Property *get_device_properties(char *node)
 
        if(!udevadm_path)
        {
+               struct stat st;
                udevadm_path = "/bin/udevadm";
-               if(access(udevadm_path, X_OK)<0)
+               if(stat(udevadm_path, &st)<0 || !(st.st_mode&0111))
                {
                        udevadm_path = "/sbin/udevadm";
-                       if(access(udevadm_path, X_OK)<0)
+                       if(stat(udevadm_path, &st)<0 || !(st.st_mode&0111))
                        {
                                udevadm_path = NULL;
                                perror("Unable to find udevadm");
@@ -542,7 +543,6 @@ Device *get_devices(void)
        char **nodes = NULL;
        Device *devices = NULL;
        int n_devices = 0;
-       char **mounted = NULL;
        char **fstab = NULL;
        int i;
 
@@ -561,6 +561,7 @@ Device *get_devices(void)
                {
                        if(verbosity>=2)
                                printf("  No properties\n");
+                       free(nodes[i]);
                        continue;
                }
 
@@ -626,7 +627,7 @@ Device *get_devices(void)
        }
 
        free(nodes);
-       free_string_array(mounted);
+       free_string_array(fstab);
 
        if(devices)
        {