Replace 'readdir_r' with 'readdir' 57/110157/2 accepted/tizen/common/20170113.184230 accepted/tizen/ivi/20170113.225032 accepted/tizen/mobile/20170113.224945 accepted/tizen/tv/20170113.225000 accepted/tizen/wearable/20170113.225014 submit/tizen/20170113.080044
authorInkyun Kil <inkyun.kil@samsung.com>
Fri, 13 Jan 2017 06:03:26 +0000 (15:03 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Fri, 13 Jan 2017 07:06:32 +0000 (16:06 +0900)
- Fix build error for toolchain upgrade.
  This patch is intended to be missing from previous patch.

Change-Id: I05ce9544b7919c7fd72e09b7a75f8139540dc886
Signed-off-by: Inkyun Kil <inkyun.kil@samsung.com>
plugin/app2sd/server/app2sd_interface.c

index 985878f..70e1bcb 100644 (file)
@@ -1606,14 +1606,12 @@ int app2sd_post_migrate_legacy(const char *pkgid, uid_t uid)
 int app2sd_migrate_legacy_all(void)
 {
        int ret = APP2EXT_SUCCESS;
-       int rc = 0;
        char buf[FILENAME_MAX] = { 0, };
        char app2sd_path[FILENAME_MAX] = { 0, };
        char loopback_device[FILENAME_MAX] = { 0, };
        char *sdpath = NULL;
        DIR *dir = NULL;
-       struct dirent entry;
-       struct dirent *result = NULL;
+       struct dirent *entry = NULL;
        uid_t default_uid = tzplatform_getuid(TZ_SYS_DEFAULT_USER);
        pkgmgr_client *pc;
 
@@ -1640,20 +1638,18 @@ int app2sd_migrate_legacy_all(void)
                return APP2EXT_ERROR_PKGMGR_ERROR;
        }
 
-       for (rc = readdir_r(dir, &entry, &result);
-               rc == 0 && result != NULL;
-               rc = readdir_r(dir, &entry, &result)) {
-               if (strcmp(entry.d_name, ".") == 0 ||
-                       strcmp(entry.d_name, "..") == 0)
+       while ((entry = readdir(dir)) != NULL) {
+               if (strcmp(entry->d_name, ".") == 0 ||
+                       strcmp(entry->d_name, "..") == 0)
                        continue;
                snprintf(loopback_device, sizeof(loopback_device), "%s/%s",
-                       app2sd_path, entry.d_name);
+                       app2sd_path, entry->d_name);
                /* check losetup image */
                if (_app2sd_check_is_luks_device(loopback_device) == 0) {
                        /* call installer backend
                           to change access-rule and broadcast this update */
                        ret = pkgmgr_client_usr_migrate_external_image(pc,
-                               entry.d_name, default_uid);
+                               entry->d_name, default_uid);
                        if (ret < 0)
                                _E("failed to request migration, ret(%d)", ret);
                }