return false;
}
- bzero(smack_label, SMACK_LABEL_LEN + 1);
+ memset(smack_label, 0x00, SMACK_LABEL_LEN + 1);
fd = fopen("/proc/self/attr/current", "r");
if (fd == NULL) {
DNSSD_LOGE("Failed to open /proc/self/attr/current");
return false;
}
- ret = fread(smack_label, sizeof(smack_label), 1, fd);
- fclose(fd);
- if (ret < 0) {
+ ret = fread(smack_label, SMACK_LABEL_LEN, 1, fd);
+ if (ret == 0 && ferror(fd)) {
DNSSD_LOGE("Failed to read /proc/self/attr/current");
+ fclose(fd);
return false;
}
+ fclose(fd);
snprintf(uid, sizeof(uid), "%d", getuid());
return false;
}
- bzero(smack_label, SMACK_LABEL_LEN + 1);
+ memset(smack_label, 0x00, SMACK_LABEL_LEN + 1);
fd = fopen("/proc/self/attr/current", "r");
if (fd == NULL) {
SSDP_LOGE("Failed to open /proc/self/attr/current");
return false;
}
- ret = fread(smack_label, sizeof(smack_label), 1, fd);
- fclose(fd);
- if (ret < 0) {
+ ret = fread(smack_label, SMACK_LABEL_LEN, 1, fd);
+ if (ret == 0 && ferror(fd)) {
SSDP_LOGE("Failed to read /proc/self/attr/current");
+ fclose(fd);
return false;
}
+ fclose(fd);
snprintf(uid, sizeof(uid), "%d", getuid());