]> git.tdb.fi Git - pmount-gui.git/commitdiff
Use stat instead of access to check for udevadm presence master
authorMikko Rasa <tdb@tdb.fi>
Mon, 23 Sep 2019 14:08:55 +0000 (17:08 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 23 Sep 2019 14:08:55 +0000 (17:08 +0300)
There's apparently some shenanigans in access so it may not actually
check anything for X_OK.

main.c

diff --git a/main.c b/main.c
index 76632ab3d50b056063beea31e4a9061c7ea9609e..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");