net_idx);
l_debug("Put Net Key %s", key_file);
- fd = open(key_file, O_WRONLY | O_CREAT | O_TRUNC);
+ fd = open(key_file, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
if (fd >= 0) {
if (write(fd, key, sizeof(*key)) == sizeof(*key))
result = true;
}
lseek(fd, 0, SEEK_SET);
} else
- fd = open(key_file, O_WRONLY | O_CREAT | O_TRUNC);
+ fd = open(key_file, O_WRONLY | O_CREAT | O_TRUNC,
+ S_IRUSR | S_IWUSR);
if (fd >= 0) {
if (write(fd, key, sizeof(*key)) == sizeof(*key))
dev_key_dir, unicast + i);
l_debug("Put Dev Key %s", key_file);
- fd = open(key_file, O_WRONLY | O_CREAT | O_TRUNC);
+ fd = open(key_file, O_WRONLY | O_CREAT | O_TRUNC,
+ S_IRUSR | S_IWUSR);
if (fd >= 0) {
if (write(fd, dev_key, 16) != 16)
result = false;
l_info("Loading configuration from %s", in_file);
fd = open(in_file, O_RDONLY);
- if (!fd)
+ if (fd < 0)
return false;
if (fstat(fd, &st) == -1) {