From ae44690ae94e7f028d5008fc51a0588622e4c823 Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Wed, 26 Jul 2023 16:37:32 +0900 Subject: [PATCH] shared: Replace do_mkdir() with syscommon_mkdir() Change-Id: I93f1691078b8ae3686035be3a87541f9fa203165 Signed-off-by: Youngjae Cho --- src/display/lock-detector.c | 3 ++- src/shared/common.c | 30 ------------------------------ src/shared/common.h | 1 - 3 files changed, 2 insertions(+), 32 deletions(-) diff --git a/src/display/lock-detector.c b/src/display/lock-detector.c index aef6969..ab46b7d 100644 --- a/src/display/lock-detector.c +++ b/src/display/lock-detector.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "core.h" #include "display-misc.h" @@ -363,7 +364,7 @@ void pm_lock_detector_init(void) { int ret; - ret = do_mkdir(DEVICED_RUN_PATH, 0770); + ret = syscommon_mkdir(DEVICED_RUN_PATH, 0770); if (ret < 0) { _E("Fail to make directory %d", ret); return; diff --git a/src/shared/common.c b/src/shared/common.c index 3b49bd8..7390ac1 100644 --- a/src/shared/common.c +++ b/src/shared/common.c @@ -42,33 +42,3 @@ int get_systemd_reboot_param(char *buf, unsigned bufsize) return r; } - -int do_mkdir(const char *path, mode_t mode) -{ - char d[PATH_MAX]; - size_t s, l; - int r, p; - - assert(path); - - l = strlen(path); - - for (p = 0, s = 0; p < l; p += s + 1) { - s = strcspn(path + p, "/"); - if (!s) - continue; - - assert(PATH_MAX > p + s + 1); - - r = snprintf(d, p + s + 1, "%s", path); - if (r < 0) - return r; - - r = mkdir(d, mode); - if (r < 0 && errno != EEXIST) - return -errno; - } - - return 0; -} - diff --git a/src/shared/common.h b/src/shared/common.h index 6a2517c..fb6384e 100644 --- a/src/shared/common.h +++ b/src/shared/common.h @@ -197,7 +197,6 @@ static inline void __cleanup_fclose_func(FILE **f) { #endif int get_systemd_reboot_param(char *buf, unsigned bufsize); -int do_mkdir(const char *path, mode_t mode); void watchdog_notify(void); #ifdef __cplusplus -- 2.7.4