(Modified) Deal with Toolchain upgrade 14/110814/1 accepted/tizen_common accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable accepted/tizen/common/20170118.174031 accepted/tizen/ivi/20170118.223040 accepted/tizen/mobile/20170118.222949 accepted/tizen/tv/20170118.223006 accepted/tizen/unified/20170309.033723 accepted/tizen/wearable/20170118.223022 submit/tizen/20170118.071648 submit/tizen_unified/20170308.100409
authorSunmin Lee <sunm.lee@samsung.com>
Wed, 18 Jan 2017 05:23:37 +0000 (14:23 +0900)
committerSunmin Lee <sunm.lee@samsung.com>
Wed, 18 Jan 2017 06:24:49 +0000 (15:24 +0900)
(Revert "Deal with Toolchain upgrade")
This patch substitutes deprecated function "readdir_r" with "readdir"
rather than ignoring warning.

Change-Id: I3b4d3f9c28cc60c851f30332aa88780078471085
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
src/crash-manager/CMakeLists.txt
src/crash-stack/crash-stack.c
src/dump_systemstate/CMakeLists.txt
src/log_dump/CMakeLists.txt
src/shared/util.c
src/sys-assert/CMakeLists.txt
src/sys-assert/sys-assert.c

index 9ac26d1..357fcaa 100644 (file)
@@ -23,7 +23,7 @@ FOREACH(flag ${crash-manager_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE -Wno-deprecated-declarations")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
 
 CONFIGURE_FILE(crash-manager.h.in crash-manager.h @ONLY)
 ADD_EXECUTABLE(${PROJECT_NAME} ${CRASH_MANAGER_SRCS})
index 7471e86..b64df73 100644 (file)
@@ -687,7 +687,6 @@ static void __crash_stack_print_threads(FILE* outputfile, pid_t pid, pid_t tid)
 {
        int threadnum=1;
        DIR *dir;
-       struct dirent entry;
        struct dirent *dentry=NULL;
        char task_path[PATH_MAX];
        struct stat sb;
@@ -710,7 +709,7 @@ static void __crash_stack_print_threads(FILE* outputfile, pid_t pid, pid_t tid)
                if (!dir) {
                        fprintf(errfile, "[crash-stack] cannot open %s\n", task_path);
                } else {
-                       while (readdir_r(dir, &entry, &dentry) == 0 && dentry) {
+                       while ((dentry = readdir(dir))) {
                                if (strcmp(dentry->d_name, ".") == 0 ||
                                    strcmp(dentry->d_name, "..") == 0)
                                        continue;
index d889526..d15805b 100755 (executable)
@@ -16,7 +16,7 @@ ENDFOREACH(flag)
 
 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -finstrument-functions")
 
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE -Wno-deprecated-declarations")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
 MESSAGE("FLAGS: ${CMAKE_C_FLAGS}")
 
 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
index 8504860..20202b6 100644 (file)
@@ -20,7 +20,7 @@ FOREACH(flag ${log_dump_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE -Wno-deprecated-declarations")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
 
 CONFIGURE_FILE(log_dump.h.in log_dump.h @ONLY)
 ADD_EXECUTABLE(${PROJECT_NAME} ${LOG_DUMP_SRCS})
index 01445fd..b124572 100644 (file)
@@ -292,7 +292,6 @@ int run_command_write_fd(char *cmd, int dfd)
 static int remove_dir_internal(int fd)
 {
        DIR *dir;
-       struct dirent e;
        struct dirent *de;
        int subfd, ret = 0;
 
@@ -300,7 +299,7 @@ static int remove_dir_internal(int fd)
        if (!dir)
                return -1;
 
-       while ((ret = readdir_r(dir, &e, &de)) == 0 && de) {
+       while ((de = readdir(dir))) {
                if (de->d_type == DT_DIR) {
                        if (!strncmp(de->d_name, ".", 2) || !strncmp(de->d_name, "..", 3))
                                continue;
@@ -354,7 +353,6 @@ int remove_dir(const char *path, int del_dir)
 int get_exec_pid(const char *execpath)
 {
        DIR *dp;
-       struct dirent entry;
        struct dirent *dentry;
        int pid = -1, fd;
        int ret;
@@ -369,10 +367,8 @@ int get_exec_pid(const char *execpath)
        }
 
        len = strlen(execpath) + 1;
-       if ((readdir_r(dp, &entry, &dentry)) != 0)
-               dentry = NULL;
 
-       while (dentry != NULL) {
+       while ((dentry = readdir(dp))) {
                if (!isdigit(dentry->d_name[0]))
                        continue;
 
@@ -404,7 +400,6 @@ int get_exec_pid(const char *execpath)
 int get_file_count(char *path)
 {
        DIR *dir;
-       struct dirent p;
        struct dirent *dp;
        int count = 0;
 
@@ -412,10 +407,7 @@ int get_file_count(char *path)
        if (!dir)
                return 0;
 
-       if ((readdir_r(dir, &p, &dp)) != 0)
-               dp = NULL;
-
-       while (dp != NULL) {
+       while ((dp = readdir(dir))) {
                const char *name = dp->d_name;
                /* always skip "." and ".." */
                if (name[0] == '.') {
@@ -433,12 +425,10 @@ int get_file_count(char *path)
 int get_directory_usage(char *path)
 {
        DIR *dir;
-       struct dirent e;
        struct dirent *de;
        struct stat st;
        size_t usage = 0;
        int fd = -1;
-       int ret;
 
        fd = open(path, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW|O_NOATIME);
        if (fd < 0)
@@ -449,7 +439,7 @@ int get_directory_usage(char *path)
                return -1;
        }
 
-       while ((ret = readdir_r(dir, &e, &de)) == 0 && de) {
+       while ((de = readdir(dir))) {
                if (!strncmp(de->d_name, ".", 2) || !strncmp(de->d_name, "..", 3))
                        continue;
                if (fstatat(fd, de->d_name, &st, AT_SYMLINK_NOFOLLOW) < 0) {
index 11672d0..e6c7ca0 100644 (file)
@@ -48,8 +48,6 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
 SET(CMAKE_C_FLAGS_RELEASE "-O2")
 
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
-
 FIND_PROGRAM(UNAME NAMES uname)
 EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
 IF("${ARCH}" STREQUAL "arm")
@@ -71,4 +69,4 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/tizen-debug-on.service DESTINATION /us
 
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/tizen-debug-off.service DESTINATION /usr/lib/systemd/system
         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
-        GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+        GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
\ No newline at end of file
index 0c1bbf2..212e966 100644 (file)
@@ -595,7 +595,6 @@ void sighandler(int signum, siginfo_t *info, void *context)
        pid_t pid;
        pid_t tid;
        DIR *dir;
-       struct dirent entry;
        struct dirent *dentry=NULL;
        char timestr[TIME_MAX_LEN];
        char processname[NAME_MAX] = {0,};
@@ -773,7 +772,7 @@ void sighandler(int signum, siginfo_t *info, void *context)
                if (!dir) {
                        fprintf(stderr, "[sys-assert]can't open %s\n", TASK_PATH);
                } else {
-                       while (readdir_r(dir, &entry, &dentry) == 0 && dentry) {
+                       while ((dentry = readdir(dir))) {
                                if (strcmp(dentry->d_name, ".") == 0
                                                || strcmp(dentry->d_name, "..") == 0)
                                        continue;