Fixed invalid smack label for cynara check 13/66813/1 accepted/tizen/common/20160421.161808 accepted/tizen/ivi/20160422.065951 accepted/tizen/mobile/20160422.070057 accepted/tizen/tv/20160422.070010 accepted/tizen/wearable/20160422.065933 submit/tizen/20160421.073835
authorkj7.sung <kj7.sung@samsung.com>
Thu, 21 Apr 2016 07:22:43 +0000 (16:22 +0900)
committerkj7.sung <kj7.sung@samsung.com>
Thu, 21 Apr 2016 07:22:43 +0000 (16:22 +0900)
Change-Id: I2b4df144d3350aaf4aa58efed3c0928c2b179de4
Signed-off-by: kj7.sung <kj7.sung@samsung.com>
location/manager/location-privacy.c

index ec3eede..d0a3fa9 100644 (file)
@@ -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);
        }