shared: Replace sys_check_node() with access() 57/296257/1
authorYoungjae Cho <y0.cho@samsung.com>
Mon, 24 Jul 2023 10:28:54 +0000 (19:28 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Mon, 24 Jul 2023 10:28:54 +0000 (19:28 +0900)
Change-Id: I56c9e398bd176930e5ae05fafdce440ef459d2fe
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/power/power-suspend.c
src/shared/common.c
src/shared/common.h

index d96697a..d6e41e8 100644 (file)
@@ -294,7 +294,7 @@ int pm_get_power_lock_support(void)
        if (power_lock_support >= 0)
                goto out;
 
-       ret_val = sys_check_node(POWER_LOCK_PATH);
+       ret_val = access(POWER_LOCK_PATH, F_OK);
        if (ret_val < 0)
                power_lock_support = false;
        else
index d87c54e..67c22c7 100644 (file)
 
 #define BUFF_MAX        255
 
-/*
- * Helper function
- * - Read from sysfs entry
- * - Write to sysfs entry
- */
-int sys_check_node(char *path)
-{
-       int fd;
-
-       fd = open(path, O_RDONLY);
-       if (fd == -1)
-               return -1;
-
-       close(fd);
-       return 0;
-}
-
 int get_systemd_reboot_param(char *buf, unsigned bufsize)
 {
        int r = sys_read_buf("/run/systemd/reboot-param", buf, bufsize);
index 12e2814..da1e04c 100644 (file)
@@ -197,7 +197,6 @@ static inline void __cleanup_fclose_func(FILE **f) {
 #endif
 
 int run_child(int argc, const char *argv[]);
-int sys_check_node(char *path);
 int get_systemd_reboot_param(char *buf, unsigned bufsize);
 int mount_check(const char* path);
 void umount_partition_by_kill(const char *path, const int max_retry);