Add error handling routine for pkg db recovery 13/229513/3
authorJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 1 Apr 2020 11:21:47 +0000 (20:21 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Fri, 10 Apr 2020 05:28:02 +0000 (05:28 +0000)
Change-Id: I9e6f23e14d44b0d11c8d7fa92d4cacfcfc6303c9
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
tool/pkg-db-recovery.c

index f97b096..650f3c0 100644 (file)
@@ -315,6 +315,10 @@ static void _get_user_list()
 
        snprintf(traverse_path, sizeof(traverse_path), "%s/user", db_path);
        dir = opendir(traverse_path);
+       if (!dir) {
+               LOGE("Failed to open dir: %d (%s)", errno, traverse_path);
+               return;
+       }
 
        while ((ent = readdir(dir)) != NULL) {
                ret = snprintf(abs_dirname, PATH_MAX, "%s/%s", traverse_path,