diff options
-rw-r--r-- | src/librc/librc-daemon.c | 6 | ||||
-rw-r--r-- | src/librc/librc-depend.c | 12 | ||||
-rw-r--r-- | src/librc/librc-stringlist.c | 2 | ||||
-rw-r--r-- | src/librc/librc.c | 16 | ||||
-rw-r--r-- | src/librc/rc.h.in | 6 | ||||
-rw-r--r-- | src/rc/fstabinfo.c | 2 | ||||
-rw-r--r-- | src/rc/rc-applets.c | 4 | ||||
-rw-r--r-- | src/rc/rc-depend.c | 2 | ||||
-rw-r--r-- | src/rc/rc-logger.c | 2 | ||||
-rw-r--r-- | src/rc/rc-misc.c | 2 | ||||
-rw-r--r-- | src/rc/rc-plugin.c | 2 | ||||
-rw-r--r-- | src/rc/rc.c | 12 | ||||
-rw-r--r-- | src/rc/runscript.c | 26 | ||||
-rw-r--r-- | src/rc/start-stop-daemon.c | 6 |
14 files changed, 50 insertions, 50 deletions
diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c index 1bedf299..6a45e0c0 100644 --- a/src/librc/librc-daemon.c +++ b/src/librc/librc-daemon.c @@ -40,7 +40,7 @@ pid_is_exec(pid_t pid, const char *exec) int c; bool retval = false; - exec = basename_c(exec); + exec = basename_c(exec); snprintf(buffer, sizeof(buffer), "/proc/%d/stat", pid); if ((fp = fopen(buffer, "r"))) { while ((c = getc(fp)) != EOF && c != '(') @@ -297,7 +297,7 @@ _match_list(const char *exec, const char* const* argv, const char *pidfile) rc_stringlist_add(match, m); free(m); } - + while (argv && argv[i]) { l = strlen(*argv) + strlen("argv_=") + 16; m = xmalloc(sizeof(char) * l); @@ -323,7 +323,7 @@ rc_service_daemon_set(const char *service, const char *exec, const char *pidfile, bool started) { char dirpath[PATH_MAX]; - char file[PATH_MAX]; + char file[PATH_MAX]; int nfiles = 0; char oldfile[PATH_MAX] = { '\0' }; bool retval = false; diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c index 13f9076e..0b25f359 100644 --- a/src/librc/librc-depend.c +++ b/src/librc/librc-depend.c @@ -178,7 +178,7 @@ rc_deptree_load_file(const char *deptree_file) } fclose(fp); free(line); - + return deptree; } @@ -186,7 +186,7 @@ static bool valid_service(const char *runlevel, const char *service, const char *type) { RC_SERVICE state; - + if (!runlevel || strcmp(type, "ineed") == 0 || strcmp(type, "needsme") == 0) @@ -398,7 +398,7 @@ visit_service(const RC_DEPTREE *deptree, if (!(di = get_depinfo(deptree, service->value))) continue; provided = get_provided(di, runlevel, options); - + if (TAILQ_FIRST(provided)) { TAILQ_FOREACH(p, provided, entries) { di = get_depinfo(deptree, p->value); @@ -772,14 +772,14 @@ rc_deptree_update(void) if (!depinfo || strcmp(depinfo->service, service) != 0) { deptype = NULL; depinfo = get_depinfo(deptree, service); - if (!depinfo) { + if (!depinfo) { depinfo = xmalloc(sizeof(*depinfo)); TAILQ_INIT(&depinfo->depends); depinfo->service = xstrdup(service); TAILQ_INSERT_TAIL(deptree, depinfo, entries); } } - + /* We may not have any depends */ if (!type || !depends) continue; @@ -820,7 +820,7 @@ rc_deptree_update(void) depend[l - 2] == 's' && depend[l - 1] == 'h') continue; - + /* Remove our dependency if instructed */ if (depend[0] == '!') { rc_stringlist_delete(deptype->services, depend + 1); diff --git a/src/librc/librc-stringlist.c b/src/librc/librc-stringlist.c index c3825cbd..818a31cb 100644 --- a/src/librc/librc-stringlist.c +++ b/src/librc/librc-stringlist.c @@ -146,7 +146,7 @@ librc_hidden_def(rc_stringlist_sort) void rc_stringlist_free(RC_STRINGLIST *list) { - RC_STRING *s1; + RC_STRING *s1; RC_STRING *s2; if (!list) diff --git a/src/librc/librc.c b/src/librc/librc.c index 8a9fd796..8d661b12 100644 --- a/src/librc/librc.c +++ b/src/librc/librc.c @@ -72,7 +72,7 @@ ls_dir(const char *dir, int options) { DIR *dp; struct dirent *d; - RC_STRINGLIST *list = NULL; + RC_STRINGLIST *list = NULL; struct stat buf; size_t l; char file[PATH_MAX]; @@ -209,9 +209,9 @@ rc_sys_v2(void) if(systype) { char* s = systype; // Convert to uppercase - while(s && *s) { + while(s && *s) { if(islower((unsigned char)*s)) - *s = toupper((unsigned char)*s); + *s = toupper((unsigned char)*s); s++; } // Now do detection @@ -247,7 +247,7 @@ rc_sys_v1(void) { #ifdef PREFIX return RC_SYS_PREFIX; -#else +#else #ifdef __FreeBSD__ int jailed = 0; @@ -389,7 +389,7 @@ bool rc_runlevel_stack(const char *dst, const char *src) { char d[PATH_MAX], s[PATH_MAX]; - + if (!rc_runlevel_exists(dst) || !rc_runlevel_exists(src)) return false; snprintf(s, sizeof(s), "../%s", src); @@ -402,7 +402,7 @@ bool rc_runlevel_unstack(const char *dst, const char *src) { char path[PATH_MAX]; - + snprintf(path, sizeof(path), "%s/%s/%s", RC_RUNLEVELDIR, dst, src); return (unlink(path) == 0 ? true : false); } @@ -638,7 +638,7 @@ rc_service_mark(const char *service, const RC_SERVICE state) } skip_state = state; } - + if (state == RC_SERVICE_HOTPLUGGED || state == RC_SERVICE_FAILED) { free(init); return true; @@ -786,7 +786,7 @@ rc_service_value_set(const char *service, const char *option, { FILE *fp; char file[PATH_MAX]; - char *p = file; + char *p = file; p += snprintf(file, sizeof(file), RC_SVCDIR "/options/%s", service); if (mkdir(file, 0755) != 0 && errno != EEXIST) diff --git a/src/librc/rc.h.in b/src/librc/rc.h.in index 7ed8f226..5aad1d55 100644 --- a/src/librc/rc.h.in +++ b/src/librc/rc.h.in @@ -342,7 +342,7 @@ typedef void *RC_DEPTREE; * @param target * @param mtime of newest target * @param filename of the newest target (needs mtime param) - * @return true if source is newer than target, otherwise false */ + * @return true if source is newer than target, otherwise false */ bool rc_newer_than(const char *, const char *, time_t *, char *); /*! Check to see if source is older than target. @@ -351,7 +351,7 @@ bool rc_newer_than(const char *, const char *, time_t *, char *); * @param target * @param mtime of oldest target * @param filename of the oldest target (needs mtime param) - * @return true if source is older than target, otherwise false */ + * @return true if source is older than target, otherwise false */ bool rc_older_than(const char *, const char *, time_t *, char *); /*! Update the cached dependency tree if it's older than any init script, @@ -508,7 +508,7 @@ RC_STRING *rc_stringlist_find(RC_STRINGLIST *, const char *); RC_STRINGLIST *rc_stringlist_split(const char *, const char *); -/*! Sort the list according to C locale +/*! Sort the list according to C locale * @param list to sort */ void rc_stringlist_sort(RC_STRINGLIST **); diff --git a/src/rc/fstabinfo.c b/src/rc/fstabinfo.c index a05bfae6..69b5bbdd 100644 --- a/src/rc/fstabinfo.c +++ b/src/rc/fstabinfo.c @@ -109,7 +109,7 @@ do_mount(struct ENT *ent) argv[6] = ENT_FILE(*ent); argv[7] = NULL; switch (pid = vfork()) { - case -1: + case -1: eerrorx("%s: vfork: %s", applet, strerror(errno)); /* NOTREACHED */ case 0: diff --git a/src/rc/rc-applets.c b/src/rc/rc-applets.c index 11bc2d50..ba2815d7 100644 --- a/src/rc/rc-applets.c +++ b/src/rc/rc-applets.c @@ -298,7 +298,7 @@ do_service(int argc, char **argv) } } ok = rc_service_started_daemon(service, exec, NULL, idx); - + } else if (strcmp(applet, "service_crashed") == 0) { ok = (_rc_can_find_pids() && rc_service_daemons_crashed(service) && @@ -476,7 +476,7 @@ run_applets(int argc, char **argv) exit(EXIT_FAILURE); } exit(EXIT_SUCCESS); - }; + }; if (applet[0] == 'e' || (applet[0] == 'v' && applet[1] == 'e')) exit(do_e(argc, argv)); diff --git a/src/rc/rc-depend.c b/src/rc/rc-depend.c index 2b78fcbd..7a4656e1 100644 --- a/src/rc/rc-depend.c +++ b/src/rc/rc-depend.c @@ -176,7 +176,7 @@ rc_depend(int argc, char **argv) case_RC_COMMON_GETOPT } } - + if(deptree_file) { if(!(deptree = rc_deptree_load_file(deptree_file))) eerrorx("failed to load deptree"); diff --git a/src/rc/rc-logger.c b/src/rc/rc-logger.c index 47349893..e45c327d 100644 --- a/src/rc/rc-logger.c +++ b/src/rc/rc-logger.c @@ -172,7 +172,7 @@ rc_logger_open(const char *level) ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws); if (openpty(&rc_logger_tty, &slave_tty, NULL, &tt, &ws)) return; - } else + } else if (openpty(&rc_logger_tty, &slave_tty, NULL, NULL, NULL)) return; diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c index 0239f9d4..92be3b8a 100644 --- a/src/rc/rc-misc.c +++ b/src/rc/rc-misc.c @@ -316,7 +316,7 @@ exec_service(const char *service, const char *arg) fd = svc_lock(basename_c(service)); if (fd == -1) return -1; - + file = rc_service_resolve(service); if (!exists(file)) { rc_service_mark(service, RC_SERVICE_STOPPED); diff --git a/src/rc/rc-plugin.c b/src/rc/rc-plugin.c index 592eb09c..6f07471d 100644 --- a/src/rc/rc-plugin.c +++ b/src/rc/rc-plugin.c @@ -200,7 +200,7 @@ rc_plugin_run(RC_HOOK hook, const char *value) sigaction(SIGUSR1, &sa, NULL); sigaction(SIGWINCH, &sa, NULL); sigprocmask(SIG_SETMASK, &old, NULL); - + rc_in_plugin = true; close(pfd[0]); rc_environ_fd = fdopen(pfd[1], "w"); diff --git a/src/rc/rc.c b/src/rc/rc.c index a2e095db..af346657 100644 --- a/src/rc/rc.c +++ b/src/rc/rc.c @@ -153,7 +153,7 @@ cleanup(void) #ifdef DEBUG_MEMORY while (p1) { - p2 = LIST_NEXT(p1, entries); + p2 = LIST_NEXT(p1, entries); free(p1); p1 = p2; } @@ -315,7 +315,7 @@ open_shell(void) { const char *shell; struct passwd *pw; - + #ifdef __linux__ const char *sys = rc_sys(); @@ -586,7 +586,7 @@ do_stop_services(const char *newlevel, bool parallel, bool going_down) } crashed = rc_conf_yesno("rc_crashed_stop"); - + nostop = rc_stringlist_split(rc_conf_value("rc_nostop"), " "); TAILQ_FOREACH_REVERSE(service, stop_services, rc_stringlist, entries) { @@ -821,9 +821,9 @@ main(int argc, char **argv) * than trusting argv[0], as argv[0] is not going to be the applet value if * we are doing SELinux context switching. For this, we allow calls such as * 'rc --applet APPLET', and shift ALL of argv down by two array items. */ - if(strcmp(basename_c(argv[0]), "rc") == 0 && strcmp(argv[1], "--applet") == 0) { - for(i = 2; i < argc; i++) - argv[i-2] = argv[i]; + if(strcmp(basename_c(argv[0]), "rc") == 0 && strcmp(argv[1], "--applet") == 0) { + for(i = 2; i < argc; i++) + argv[i-2] = argv[i]; argv[argc-2] = NULL; argv[argc-1] = NULL; argc -= 2; diff --git a/src/rc/runscript.c b/src/rc/runscript.c index 1c60c249..0eca4879 100644 --- a/src/rc/runscript.c +++ b/src/rc/runscript.c @@ -451,7 +451,7 @@ svc_exec(const char *arg1, const char *arg2) signal_pipe[0] = signal_pipe[1] = -1; sigprocmask (SIG_SETMASK, &oldmask, NULL); - + if (master_tty >= 0) { /* Why did we do this? */ /* signal (SIGWINCH, SIG_IGN); */ @@ -572,7 +572,7 @@ svc_start_check(void) RC_SERVICE state; state = rc_service_state(service); - + if (in_background) { if (!(state & (RC_SERVICE_INACTIVE | RC_SERVICE_STOPPED))) exit(EXIT_FAILURE); @@ -583,7 +583,7 @@ svc_start_check(void) " next runlevel", applet); } - if (exclusive_fd == -1) + if (exclusive_fd == -1) exclusive_fd = svc_lock(applet); if (exclusive_fd == -1) { if (errno == EACCES) @@ -603,7 +603,7 @@ svc_start_check(void) else if (state & RC_SERVICE_INACTIVE && !in_background) ewarnx("WARNING: %s has already started, but is inactive", applet); - + rc_service_mark(service, RC_SERVICE_STARTING); hook_out = RC_HOOK_SERVICE_START_OUT; rc_plugin_run(RC_HOOK_SERVICE_START_IN, applet); @@ -619,7 +619,7 @@ svc_start_deps(void) size_t len; char *p, *tmp; pid_t pid; - + errno = 0; if (rc_conf_yesno("rc_depend_strict") || errno == ENOENT) depoptions |= RC_DEP_STRICT; @@ -725,7 +725,7 @@ svc_start_deps(void) n = 0; TAILQ_FOREACH(svc, tmplist, entries) { rc_service_schedule_start(svc->value, service); - use_services = rc_deptree_depend(deptree, + use_services = rc_deptree_depend(deptree, "iprovide", svc->value); TAILQ_FOREACH(svc2, use_services, entries) rc_service_schedule_start(svc2->value, service); @@ -760,7 +760,7 @@ static void svc_start_real() { bool started; RC_STRING *svc, *svc2; - + if (ibsave) setenv("IN_BACKGROUND", ibsave, 1); hook_out = RC_HOOK_SERVICE_START_DONE; @@ -873,7 +873,7 @@ svc_stop_deps(RC_SERVICE state) if (state & RC_SERVICE_WASINACTIVE) return; - + errno = 0; if (rc_conf_yesno("rc_depend_strict") || errno == ENOENT) depoptions |= RC_DEP_STRICT; @@ -941,7 +941,7 @@ svc_stop_deps(RC_SERVICE state) } rc_stringlist_free(tmplist); tmplist = NULL; - + /* We now wait for other services that may use us and are * stopping. This is important when a runlevel stops */ services = rc_deptree_depends(deptree, types_mua, applet_list, @@ -959,7 +959,7 @@ static void svc_stop_real(void) { bool stopped; - + /* If we're stopping localmount, set LC_ALL=C so that * bash doesn't load anything blocking the unmounting of /usr */ if (strcmp(applet, "localmount") == 0) @@ -1138,7 +1138,7 @@ runscript(int argc, char **argv) file = basename_c(argv[1]); else file = basename_c(lnk); - dir = save; + dir = save; } else file = basename_c(argv[1]); ll = strlen(dir) + strlen(file) + 2; @@ -1206,7 +1206,7 @@ runscript(int argc, char **argv) #endif deps = true; - + /* Punt the first arg as its our service name */ argc--; argv++; @@ -1363,7 +1363,7 @@ runscript(int argc, char **argv) RC_SERVICE_INACTIVE) { TAILQ_FOREACH(svc, - restart_services, + restart_services, entries) if (rc_service_state(svc->value) & RC_SERVICE_STOPPED) diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index bd6c7bfe..459bcf15 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -322,7 +322,7 @@ get_pid(const char *pidfile, bool quiet) fclose(fp); return -1; } - + fclose(fp); return pid; @@ -631,7 +631,7 @@ static const struct option longopts[] = { longopts_COMMON }; static const char * const longopts_help[] = { - "Set an ionice class:data when starting", + "Set an ionice class:data when starting", "Stop daemon", "Set a nicelevel when starting", "Retry schedule to use when stopping", @@ -1343,7 +1343,7 @@ start_stop_daemon(int argc, char **argv) if (start_wait > 0) { struct timespec ts; bool alive = false; - + ts.tv_sec = start_wait / 1000; ts.tv_nsec = (start_wait % 1000) * ONE_MS; if (nanosleep(&ts, NULL) == -1) { |