if (!pwentp) {
if (ret == 0)
mysyslog(LOG_ERR,
- "Could not find matched password record\n", NULL);
+ "Could not find matched password record\n", NULL);
free(buf);
return false;
char *range = strchr(token, '-');
if (range)
end = strtoul(range + 1, NULL, 0);
+
if (!(start <= end)) {
free(bitarr);
return NULL;
free_string_list(cpulist);
return NULL;
}
+
must_append_string(&cpulist, numstr);
}
}
+
return string_join(",", (const char **)cpulist, false);
}
else if (c1 < c2)
c1 = c2;
+ if (!c1)
+ return -1;
+
/* If the above logic is correct, c1 should always hold a valid string
* here.
*/
-
errno = 0;
cpus = strtoul(c1, NULL, 0);
if (errno != 0)
static ssize_t write_nointr(int fd, const void* buf, size_t count)
{
ssize_t ret;
+
again:
ret = write(fd, buf, count);
if (ret < 0 && errno == EINTR)
goto again;
+
return ret;
}
fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, 0666);
if (fd < 0)
return -1;
+
ret = write_nointr(fd, buf, count);
if (ret < 0)
goto out_error;
if ((size_t)ret != count)
goto out_error;
+
if (add_newline) {
ret = write_nointr(fd, "\n", 1);
if (ret != 1)
goto out_error;
}
+
close(fd);
return 0;