From: kj7.sung Date: Thu, 21 Apr 2016 07:22:43 +0000 (+0900) Subject: Fixed invalid smack label for cynara check X-Git-Tag: accepted/tizen/common/20160421.161808^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5fecd9169f1562b51376e6d1955f854b7d6fe1d7;p=platform%2Fcore%2Flocation%2Flbs-location.git Fixed invalid smack label for cynara check Change-Id: I2b4df144d3350aaf4aa58efed3c0928c2b179de4 Signed-off-by: kj7.sung --- diff --git a/location/manager/location-privacy.c b/location/manager/location-privacy.c index ec3eede..d0a3fa9 100644 --- a/location/manager/location-privacy.c +++ b/location/manager/location-privacy.c @@ -41,7 +41,7 @@ int location_check_cynara(const char *privilege_name) FILE *fp = NULL; char uid[16]; char *session = NULL; - char smack_label[100] = "/proc/self/attr/current"; + char smack_label[100] = {0, }; if (cynara_initialize(&cynara, NULL) != CYNARA_API_SUCCESS) { @@ -52,8 +52,11 @@ int location_check_cynara(const char *privilege_name) fp = fopen("/proc/self/attr/current", "r"); if (fp != NULL) { - if (fread(smack_label, 1, sizeof(smack_label), fp) <= 0) { - LOCATION_LOGE("fread failed"); + int ch = 0; + int idx = 0; + while (EOF != (ch = fgetc(fp))) { + smack_label[idx] = ch; + idx++; } fclose(fp); }