X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fsysctl.c;h=57fba25605765ec36986e4f8498d410638c6cc2c;hb=68fb08920b2162b48cf0fa8dd98b021327b42896;hp=8bdfb0811ce880b01601c7120f549a62cb785394;hpb=4c12626c8e3491570b395d68380543e10c98ad33;p=elogind.git diff --git a/src/sysctl.c b/src/sysctl.c index 8bdfb0811..57fba2560 100644 --- a/src/sysctl.c +++ b/src/sysctl.c @@ -6,16 +6,16 @@ Copyright 2010 Lennart Poettering systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. systemd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with systemd; If not, see . ***/ @@ -219,28 +219,34 @@ int main(int argc, char *argv[]) { if (r <= 0) return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; - if (argc-optind > 1) { - log_error("This program expects one or no arguments."); - return EXIT_FAILURE; - } - log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); umask(0022); - if (argc > optind) - r = apply_file(argv[optind], false); - else { + if (argc > optind) { + int i; + + for (i = optind; i < argc; i++) { + int k; + + k = apply_file(argv[i], false); + if (k < 0 && r == 0) + r = k; + } + } else { char **files, **f; + int k; r = conf_files_list(&files, ".conf", - "/run/sysctl.d", "/etc/sysctl.d", + "/run/sysctl.d", "/usr/local/lib/sysctl.d", "/usr/lib/sysctl.d", +#ifdef HAVE_SPLIT_USR "/lib/sysctl.d", +#endif NULL); if (r < 0) { log_error("Failed to enumerate sysctl.d files: %s", strerror(-r)); @@ -248,14 +254,14 @@ int main(int argc, char *argv[]) { } STRV_FOREACH(f, files) { - int k; - k = apply_file(*f, true); if (k < 0 && r == 0) r = k; } - apply_file("/etc/sysctl.conf", true); + k = apply_file("/etc/sysctl.conf", true); + if (k < 0 && r == 0) + r = k; strv_free(files); }