Truncate Smack file for app in app_revoke_permissions().
authorRafal Krypa <r.krypa@samsung.com>
Wed, 17 Apr 2013 12:04:42 +0000 (14:04 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Wed, 17 Apr 2013 19:36:15 +0000 (21:36 +0200)
[Issue#]       N/A
[Feature]      The function removed rules from kernel, but not from disk.
[Cause]        It used to remove the file, but removal is now done in app_uninstall().
[Solution]     Add explicit truncate.
[Verification] Run tests from security-tests package.

Change-Id: I17e0cf25c95f59762a3b8fcc53a1cdf1d113d3e0

src/privilege-control.c

index a525187..54e8e4f 100644 (file)
@@ -1015,6 +1015,9 @@ API int app_revoke_permissions(const char* app_id)
                goto out;
        }
 
+       if (ftruncate(fd, 0) == -1)
+               C_LOGE("file truncate failed");
+
        ret = PC_OPERATION_SUCCESS;
 out:
        if (fd != -1)