From: Rafal Krypa Date: Fri, 12 Apr 2013 16:31:04 +0000 (+0200) Subject: Change implementation of have_smack() X-Git-Tag: submit/tizen_2.2/20130714.151203~7^2~53 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f1cb4760f34f506a2d46994f688b71cfb9320e27;p=framework%2Fsecurity%2Flibprivilege-control.git Change implementation of have_smack() [Issue#] N/A [Feature] More reliable checking whether Smack is available in runtime. [Cause] Code reuse. [Solution] Use function provided in libsmack to check usability of smackfs. [Verification] Run tests from security-tests. Change-Id: Ib237a0a6ddbcdd966daac35bc8c416338c501af2 --- diff --git a/src/privilege-control.c b/src/privilege-control.c index 0752c33..a525187 100644 --- a/src/privilege-control.c +++ b/src/privilege-control.c @@ -211,13 +211,11 @@ static inline int have_smack(void) static int have_smack = -1; if (-1 == have_smack) { - int fd = open("/smack/load2", O_WRONLY); - if (-1 == fd) { + if (NULL == smack_smackfs_path()) { C_LOGD("Libprivilage-control: no smack found on phone"); have_smack = 0; } else { C_LOGD("Libprivilege-control: found smack on phone"); - close(fd); have_smack = 1; } }