remove unused code 22/227922/1
authorSemun Lee <semun.lee@samsung.com>
Tue, 17 Mar 2020 08:10:10 +0000 (17:10 +0900)
committerSemun Lee <semun.lee@samsung.com>
Tue, 17 Mar 2020 08:10:10 +0000 (17:10 +0900)
It creates unncessary noise in static analyzers

Change-Id: I269efd772f54794b584c99eb224a4f1ba502f2e2
Signed-off-by: Semun Lee <semun.lee@samsung.com>
src/core/common.c
src/core/common.h

index c393c14..5854082 100644 (file)
@@ -137,70 +137,6 @@ int is_app(pid_t pid)
        return 1;
 }
 
-static int remove_dir_internal(int fd)
-{
-       DIR *dir;
-       struct dirent *de = NULL;
-       int subfd, ret = 0;
-
-       dir = fdopendir(fd);
-       if (!dir)
-               return -1;
-       while (1) {
-               de = readdir(dir);
-               if (ret != 0 || de == NULL)
-                       break;
-               if (de->d_type == DT_DIR) {
-                       if (!strncmp(de->d_name, ".", 2) || !strncmp(de->d_name, "..", 3))
-                               continue;
-                       subfd = openat(fd, de->d_name, O_RDONLY | O_DIRECTORY);
-                       if (subfd < 0) {
-                               _SE("Couldn't openat %s: %d\n", de->d_name, errno);
-                               ret = -1;
-                               continue;
-                       }
-                       if (remove_dir_internal(subfd))
-                               ret = -1;
-
-                       close(subfd);
-                       if (unlinkat(fd, de->d_name, AT_REMOVEDIR) < 0) {
-                               _SE("Couldn't unlinkat %s: %d\n", de->d_name, errno);
-                               ret = -1;
-                       }
-               } else {
-                       if (unlinkat(fd, de->d_name, 0) < 0) {
-                               _SE("Couldn't unlinkat %s: %d\n", de->d_name, errno);
-                               ret = -1;
-                       }
-               }
-       }
-       closedir(dir);
-       return ret;
-}
-
-int remove_dir(const char *path, int del_dir)
-{
-       int fd, ret = 0;
-
-       if (!path)
-               return -1;
-       fd = open(path, O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC | O_NOFOLLOW);
-       if (fd < 0) {
-               _SE("Couldn't opendir %s: %d\n", path, errno);
-               return -errno;
-       }
-       ret = remove_dir_internal(fd);
-       close(fd);
-
-       if (del_dir) {
-               if (rmdir(path)) {
-                       _SE("Couldn't rmdir %s: %d\n", path, errno);
-                       ret = -1;
-               }
-       }
-       return ret;
-}
-
 /*
  * Helper function
  * - Read from sysfs entry
index 9971752..3f53d1e 100644 (file)
@@ -173,7 +173,6 @@ int get_cmdline_name(pid_t pid, char *cmdline, size_t cmdline_size);
 int is_vip(int pid);
 int is_app(pid_t pid);
 int run_child(int argc, const char *argv[]);
-int remove_dir(const char *path, int del_dir);
 int sys_check_node(char *path);
 int sys_get_int(char *fname, int *val);
 int sys_set_int(char *fname, int val);