Fix build warnings 40/125840/1
authorSangyoon Jang <s89.jang@samsung.com>
Wed, 19 Apr 2017 05:39:09 +0000 (14:39 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Wed, 19 Apr 2017 05:39:09 +0000 (14:39 +0900)
- Use readdir instead of readdir_r
  (readdir_r is now deprecated at gcc6)
- Fix wrong indentation

Change-Id: I7716823c5ecfdf001dd70bd77131ba05c1439ae6
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
src/pkgmgrinfo_db.c
src/pkgmgrinfo_pkginfo.c

index 453b5bc..7af6e71 100644 (file)
@@ -463,7 +463,7 @@ int __close_cert_db(void)
        if (cert_db.ref) {
                if (--cert_db.ref == 0)
                        sqlite3_close_v2(GET_DB(cert_db));
-                       return 0;
+               return 0;
        }
        _LOGE("Certificate DB is already closed !!\n");
        return -1;
index b5cac35..0531930 100644 (file)
@@ -117,7 +117,7 @@ long long _pkgmgr_calculate_dir_size(char *dirname)
        int q = 0; /*quotient*/
        int r = 0; /*remainder*/
        DIR *dp = NULL;
-       struct dirent ep, *result;
+       struct dirent *ep;
        struct stat fileinfo;
        char abs_filename[FILENAME_MAX] = { 0, };
        retvm_if(dirname == NULL, PMINFO_R_ERROR, "dirname is NULL");
@@ -128,22 +128,20 @@ long long _pkgmgr_calculate_dir_size(char *dirname)
                return -1;
        }
 
-       for (ret = readdir_r(dp, &ep, &result);
-                       ret == 0 && result != NULL;
-                       ret = readdir_r(dp, &ep, &result)) {
-               if (!strcmp(ep.d_name, ".") ||
-                       !strcmp(ep.d_name, "..")) {
+       for (ep = readdir(dp); ep != NULL; ep = readdir(dp)) {
+               if (!strcmp(ep->d_name, ".") ||
+                       !strcmp(ep->d_name, "..")) {
                        continue;
                }
                snprintf(abs_filename, FILENAME_MAX, "%s/%s", dirname,
-                        ep.d_name);
+                        ep->d_name);
                if (lstat(abs_filename, &fileinfo) < 0)
                        perror(abs_filename);
                else {
                        if (S_ISDIR(fileinfo.st_mode)) {
                                total += fileinfo.st_size;
-                               if (strcmp(ep.d_name, ".")
-                                   && strcmp(ep.d_name, "..")) {
+                               if (strcmp(ep->d_name, ".")
+                                   && strcmp(ep->d_name, "..")) {
                                        ret = _pkgmgr_calculate_dir_size
                                            (abs_filename);
                                        total = total + ret;