From b70580815b02ba5ccf83d8d96c5138afbc7124ae Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 23 Sep 2019 17:08:55 +0300 Subject: [PATCH] Use stat instead of access to check for udevadm presence There's apparently some shenanigans in access so it may not actually check anything for X_OK. --- main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 76632ab..9172ab6 100644 --- 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"); -- 2.45.2