From: Inkyun Kil Date: Fri, 13 Jan 2017 06:03:26 +0000 (+0900) Subject: Replace 'readdir_r' with 'readdir' X-Git-Tag: submit/tizen/20170113.080044^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ffda724cf5dbbd39a0d247a81bc1cd3e56c8f22;p=platform%2Fcore%2Fappfw%2Fapp2sd.git Replace 'readdir_r' with 'readdir' - Fix build error for toolchain upgrade. This patch is intended to be missing from previous patch. Change-Id: I05ce9544b7919c7fd72e09b7a75f8139540dc886 Signed-off-by: Inkyun Kil --- diff --git a/plugin/app2sd/server/app2sd_interface.c b/plugin/app2sd/server/app2sd_interface.c index 985878f..70e1bcb 100644 --- a/plugin/app2sd/server/app2sd_interface.c +++ b/plugin/app2sd/server/app2sd_interface.c @@ -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); }