X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fsysctl%2Fsysctl.c;h=283eefe1a1d233e49786034668d64c80cbe507f6;hb=2f1a3d086860b7cff659e425ea16d8bb34dc62ac;hp=7ebe1e2df5a3716371744ee87c8fb6507ac31bc2;hpb=9f6445e34a57c270f013c9416c123e56261553dd;p=elogind.git diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c index 7ebe1e2df..283eefe1a 100644 --- a/src/sysctl/sysctl.c +++ b/src/sysctl/sysctl.c @@ -65,7 +65,7 @@ static int apply_sysctl(const char *property, const char *value) { log_debug("Setting '%s' to '%s'", property, value); - p = new(char, sizeof("/proc/sys/") + strlen(property)); + p = new(char, strlen("/proc/sys/") + strlen(property) + 1); if (!p) return log_oom(); @@ -123,7 +123,7 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno assert(path); - r = search_and_fopen_nulstr(path, "re", conf_file_dirs, &f); + r = search_and_fopen_nulstr(path, "re", NULL, conf_file_dirs, &f); if (r < 0) { if (ignore_enoent && r == -ENOENT) return 0; @@ -245,19 +245,14 @@ static int parse_argv(int argc, char *argv[]) { case ARG_PREFIX: { char *p; - char **l; for (p = optarg; *p; p++) if (*p == '.') *p = '/'; - l = strv_append(arg_prefixes, optarg); - if (!l) + if (strv_extend(&arg_prefixes, optarg) < 0) return log_oom(); - strv_free(arg_prefixes); - arg_prefixes = l; - break; }