From 07719a21b6425d378b36bb8d7f47ad5ec5296d28 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 23 May 2012 03:43:29 +0200 Subject: manager: rework generator logic Previously generated units were always placed at the end of the search path. With this change there will be three unit dirs instead of one, to place generated entries at the beginning, in the middle and at the end of the search path: beginning: for units that need to override all configuration, regardless of user or vendor. Example use: system-update-generator uses this to temporarily redirect default.target. middle: for units that need to override vendor configuration, but not vendor configuration. Example use: /etc/fstab should override vendor supplied configuration (think /tmp), but should not override native user configuration. end: does not override anything but is available as well. Possible usage might be to convert D-Bus bus service files to native units but allowing vendor supplied native units to win. --- src/rc-local-generator/rc-local-generator.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/rc-local-generator') diff --git a/src/rc-local-generator/rc-local-generator.c b/src/rc-local-generator/rc-local-generator.c index 1464c8e497..38168cc01f 100644 --- a/src/rc-local-generator/rc-local-generator.c +++ b/src/rc-local-generator/rc-local-generator.c @@ -66,7 +66,6 @@ static int add_symlink(const char *service, const char *where) { } finish: - free(from); free(to); @@ -83,20 +82,21 @@ static bool file_is_executable(const char *f) { } int main(int argc, char *argv[]) { - int r = EXIT_SUCCESS; - if (argc > 2) { - log_error("This program takes one or no arguments."); + if (argc > 1 && argc != 4) { + log_error("This program takes three or no arguments."); return EXIT_FAILURE; } + if (argc > 1) + arg_dest = argv[1]; + log_set_target(LOG_TARGET_SAFE); log_parse_environment(); log_open(); - if (argc > 1) - arg_dest = argv[1]; + umask(0022); if (file_is_executable(SCRIPT_PATH_START)) { log_debug("Automatically adding rc-local.service."); -- cgit v1.2.3-54-g00ecf