char smack_label[1024] = {'\0',};
if (!p_cynara) {
- return false;
+ return false;
}
fp = fopen(label_path, "r");
if (fp != NULL) {
- if (fread(smack_label, 1, sizeof(smack_label), fp) <= 0)
- SLOG(LOG_ERROR, TAG_VCC, "[ERROR] fail to fread");
+ if (sizeof(smack_label) != fread(smack_label, 1, sizeof(smack_label), fp))
+ SLOG(LOG_ERROR, TAG_VCC, "[ERROR] fail to fread");
- fclose(fp);
+ fclose(fp);
}
pid_t pid = getpid();
int ret = cynara_check(p_cynara, smack_label, session, uid, privilege);
SLOG(LOG_DEBUG, TAG_VCC, "[Client]cynara_check returned %d(%s)", ret, (CYNARA_API_ACCESS_ALLOWED == ret) ? "Allowed" : "Denied");
if (session)
- free(session);
+ free(session);
if (ret != CYNARA_API_ACCESS_ALLOWED)
- return false;
+ return false;
return true;
}
//remove previous space
if (' ' == temp[0])
- strncpy(temp, temp + 1, strlen(temp));
+ memmove(temp, temp + 1, strlen(temp));
// remove next space
if (' ' == temp[strlen(temp) - 1])
char smack_label[1024] = {'\0',};
if (!p_cynara) {
- return false;
+ return false;
}
fp = fopen(label_path, "r");
if (fp != NULL) {
- if (fread(smack_label, 1, sizeof(smack_label), fp) <= 0)
- SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] fail to fread");
+ if (sizeof(smack_label) != fread(smack_label, 1, sizeof(smack_label), fp))
+ SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] fail to fread");
- fclose(fp);
+ fclose(fp);
}
pid_t pid = getpid();
int ret = cynara_check(p_cynara, smack_label, session, uid, privilege);
SLOG(LOG_DEBUG, TAG_VCCMD, "[Client]cynara_check returned %d(%s)", ret, (CYNARA_API_ACCESS_ALLOWED == ret) ? "Allowed" : "Denied");
if (session)
- free(session);
+ free(session);
if (ret != CYNARA_API_ACCESS_ALLOWED)
- return false;
+ return false;
return true;
}