shared: Replace do_mkdir() with syscommon_mkdir() 71/296371/2
authorYoungjae Cho <y0.cho@samsung.com>
Wed, 26 Jul 2023 07:37:32 +0000 (16:37 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Fri, 28 Jul 2023 00:13:28 +0000 (09:13 +0900)
Change-Id: I93f1691078b8ae3686035be3a87541f9fa203165
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/display/lock-detector.c
src/shared/common.c
src/shared/common.h

index aef6969..ab46b7d 100644 (file)
@@ -32,6 +32,7 @@
 #include <sys/types.h>
 #include <libsyscommon/list.h>
 #include <libsyscommon/file.h>
+#include <libsyscommon/common.h>
 
 #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;
index 3b49bd8..7390ac1 100644 (file)
@@ -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;
-}
-
index 6a2517c..fb6384e 100644 (file)
@@ -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