X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Frc-local-generator%2Frc-local-generator.c;h=38168cc01f74af7b5d82e8b42a31a907d0217915;hb=07719a21b6425d378b36bb8d7f47ad5ec5296d28;hp=1464c8e49749876ec1fd309e9588bf60984148fe;hpb=7c4c5f68a5dd55f33bf18ccccbc8a611703fc3e2;p=elogind.git diff --git a/src/rc-local-generator/rc-local-generator.c b/src/rc-local-generator/rc-local-generator.c index 1464c8e49..38168cc01 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.");