Clean up all trailing whitespace in src/.

This commit is contained in:
Robin H. Johnson 2011-01-17 08:28:43 +00:00
parent 49339525a9
commit e6fc30da61
14 changed files with 50 additions and 50 deletions

View File

@ -40,7 +40,7 @@ pid_is_exec(pid_t pid, const char *exec)
int c; int c;
bool retval = false; bool retval = false;
exec = basename_c(exec); exec = basename_c(exec);
snprintf(buffer, sizeof(buffer), "/proc/%d/stat", pid); snprintf(buffer, sizeof(buffer), "/proc/%d/stat", pid);
if ((fp = fopen(buffer, "r"))) { if ((fp = fopen(buffer, "r"))) {
while ((c = getc(fp)) != EOF && c != '(') 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); rc_stringlist_add(match, m);
free(m); free(m);
} }
while (argv && argv[i]) { while (argv && argv[i]) {
l = strlen(*argv) + strlen("argv_=") + 16; l = strlen(*argv) + strlen("argv_=") + 16;
m = xmalloc(sizeof(char) * l); m = xmalloc(sizeof(char) * l);
@ -323,7 +323,7 @@ rc_service_daemon_set(const char *service, const char *exec,
const char *pidfile, bool started) const char *pidfile, bool started)
{ {
char dirpath[PATH_MAX]; char dirpath[PATH_MAX];
char file[PATH_MAX]; char file[PATH_MAX];
int nfiles = 0; int nfiles = 0;
char oldfile[PATH_MAX] = { '\0' }; char oldfile[PATH_MAX] = { '\0' };
bool retval = false; bool retval = false;

View File

@ -178,7 +178,7 @@ rc_deptree_load_file(const char *deptree_file)
} }
fclose(fp); fclose(fp);
free(line); free(line);
return deptree; return deptree;
} }
@ -186,7 +186,7 @@ static bool
valid_service(const char *runlevel, const char *service, const char *type) valid_service(const char *runlevel, const char *service, const char *type)
{ {
RC_SERVICE state; RC_SERVICE state;
if (!runlevel || if (!runlevel ||
strcmp(type, "ineed") == 0 || strcmp(type, "ineed") == 0 ||
strcmp(type, "needsme") == 0) strcmp(type, "needsme") == 0)
@ -398,7 +398,7 @@ visit_service(const RC_DEPTREE *deptree,
if (!(di = get_depinfo(deptree, service->value))) if (!(di = get_depinfo(deptree, service->value)))
continue; continue;
provided = get_provided(di, runlevel, options); provided = get_provided(di, runlevel, options);
if (TAILQ_FIRST(provided)) { if (TAILQ_FIRST(provided)) {
TAILQ_FOREACH(p, provided, entries) { TAILQ_FOREACH(p, provided, entries) {
di = get_depinfo(deptree, p->value); di = get_depinfo(deptree, p->value);
@ -772,14 +772,14 @@ rc_deptree_update(void)
if (!depinfo || strcmp(depinfo->service, service) != 0) { if (!depinfo || strcmp(depinfo->service, service) != 0) {
deptype = NULL; deptype = NULL;
depinfo = get_depinfo(deptree, service); depinfo = get_depinfo(deptree, service);
if (!depinfo) { if (!depinfo) {
depinfo = xmalloc(sizeof(*depinfo)); depinfo = xmalloc(sizeof(*depinfo));
TAILQ_INIT(&depinfo->depends); TAILQ_INIT(&depinfo->depends);
depinfo->service = xstrdup(service); depinfo->service = xstrdup(service);
TAILQ_INSERT_TAIL(deptree, depinfo, entries); TAILQ_INSERT_TAIL(deptree, depinfo, entries);
} }
} }
/* We may not have any depends */ /* We may not have any depends */
if (!type || !depends) if (!type || !depends)
continue; continue;
@ -820,7 +820,7 @@ rc_deptree_update(void)
depend[l - 2] == 's' && depend[l - 2] == 's' &&
depend[l - 1] == 'h') depend[l - 1] == 'h')
continue; continue;
/* Remove our dependency if instructed */ /* Remove our dependency if instructed */
if (depend[0] == '!') { if (depend[0] == '!') {
rc_stringlist_delete(deptype->services, depend + 1); rc_stringlist_delete(deptype->services, depend + 1);

View File

@ -146,7 +146,7 @@ librc_hidden_def(rc_stringlist_sort)
void void
rc_stringlist_free(RC_STRINGLIST *list) rc_stringlist_free(RC_STRINGLIST *list)
{ {
RC_STRING *s1; RC_STRING *s1;
RC_STRING *s2; RC_STRING *s2;
if (!list) if (!list)

View File

@ -72,7 +72,7 @@ ls_dir(const char *dir, int options)
{ {
DIR *dp; DIR *dp;
struct dirent *d; struct dirent *d;
RC_STRINGLIST *list = NULL; RC_STRINGLIST *list = NULL;
struct stat buf; struct stat buf;
size_t l; size_t l;
char file[PATH_MAX]; char file[PATH_MAX];
@ -209,9 +209,9 @@ rc_sys_v2(void)
if(systype) { if(systype) {
char* s = systype; char* s = systype;
// Convert to uppercase // Convert to uppercase
while(s && *s) { while(s && *s) {
if(islower((unsigned char)*s)) if(islower((unsigned char)*s))
*s = toupper((unsigned char)*s); *s = toupper((unsigned char)*s);
s++; s++;
} }
// Now do detection // Now do detection
@ -247,7 +247,7 @@ rc_sys_v1(void)
{ {
#ifdef PREFIX #ifdef PREFIX
return RC_SYS_PREFIX; return RC_SYS_PREFIX;
#else #else
#ifdef __FreeBSD__ #ifdef __FreeBSD__
int jailed = 0; int jailed = 0;
@ -389,7 +389,7 @@ bool
rc_runlevel_stack(const char *dst, const char *src) rc_runlevel_stack(const char *dst, const char *src)
{ {
char d[PATH_MAX], s[PATH_MAX]; char d[PATH_MAX], s[PATH_MAX];
if (!rc_runlevel_exists(dst) || !rc_runlevel_exists(src)) if (!rc_runlevel_exists(dst) || !rc_runlevel_exists(src))
return false; return false;
snprintf(s, sizeof(s), "../%s", src); snprintf(s, sizeof(s), "../%s", src);
@ -402,7 +402,7 @@ bool
rc_runlevel_unstack(const char *dst, const char *src) rc_runlevel_unstack(const char *dst, const char *src)
{ {
char path[PATH_MAX]; char path[PATH_MAX];
snprintf(path, sizeof(path), "%s/%s/%s", RC_RUNLEVELDIR, dst, src); snprintf(path, sizeof(path), "%s/%s/%s", RC_RUNLEVELDIR, dst, src);
return (unlink(path) == 0 ? true : false); return (unlink(path) == 0 ? true : false);
} }
@ -638,7 +638,7 @@ rc_service_mark(const char *service, const RC_SERVICE state)
} }
skip_state = state; skip_state = state;
} }
if (state == RC_SERVICE_HOTPLUGGED || state == RC_SERVICE_FAILED) { if (state == RC_SERVICE_HOTPLUGGED || state == RC_SERVICE_FAILED) {
free(init); free(init);
return true; return true;
@ -786,7 +786,7 @@ rc_service_value_set(const char *service, const char *option,
{ {
FILE *fp; FILE *fp;
char file[PATH_MAX]; char file[PATH_MAX];
char *p = file; char *p = file;
p += snprintf(file, sizeof(file), RC_SVCDIR "/options/%s", service); p += snprintf(file, sizeof(file), RC_SVCDIR "/options/%s", service);
if (mkdir(file, 0755) != 0 && errno != EEXIST) if (mkdir(file, 0755) != 0 && errno != EEXIST)

View File

@ -342,7 +342,7 @@ typedef void *RC_DEPTREE;
* @param target * @param target
* @param mtime of newest target * @param mtime of newest target
* @param filename of the newest target (needs mtime param) * @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 *); bool rc_newer_than(const char *, const char *, time_t *, char *);
/*! Check to see if source is older than target. /*! 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 target
* @param mtime of oldest target * @param mtime of oldest target
* @param filename of the oldest target (needs mtime param) * @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 *); bool rc_older_than(const char *, const char *, time_t *, char *);
/*! Update the cached dependency tree if it's older than any init script, /*! 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 *); 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 */ * @param list to sort */
void rc_stringlist_sort(RC_STRINGLIST **); void rc_stringlist_sort(RC_STRINGLIST **);

View File

@ -109,7 +109,7 @@ do_mount(struct ENT *ent)
argv[6] = ENT_FILE(*ent); argv[6] = ENT_FILE(*ent);
argv[7] = NULL; argv[7] = NULL;
switch (pid = vfork()) { switch (pid = vfork()) {
case -1: case -1:
eerrorx("%s: vfork: %s", applet, strerror(errno)); eerrorx("%s: vfork: %s", applet, strerror(errno));
/* NOTREACHED */ /* NOTREACHED */
case 0: case 0:

View File

@ -298,7 +298,7 @@ do_service(int argc, char **argv)
} }
} }
ok = rc_service_started_daemon(service, exec, NULL, idx); ok = rc_service_started_daemon(service, exec, NULL, idx);
} else if (strcmp(applet, "service_crashed") == 0) { } else if (strcmp(applet, "service_crashed") == 0) {
ok = (_rc_can_find_pids() && ok = (_rc_can_find_pids() &&
rc_service_daemons_crashed(service) && rc_service_daemons_crashed(service) &&
@ -476,7 +476,7 @@ run_applets(int argc, char **argv)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
}; };
if (applet[0] == 'e' || (applet[0] == 'v' && applet[1] == 'e')) if (applet[0] == 'e' || (applet[0] == 'v' && applet[1] == 'e'))
exit(do_e(argc, argv)); exit(do_e(argc, argv));

View File

@ -176,7 +176,7 @@ rc_depend(int argc, char **argv)
case_RC_COMMON_GETOPT case_RC_COMMON_GETOPT
} }
} }
if(deptree_file) { if(deptree_file) {
if(!(deptree = rc_deptree_load_file(deptree_file))) if(!(deptree = rc_deptree_load_file(deptree_file)))
eerrorx("failed to load deptree"); eerrorx("failed to load deptree");

View File

@ -172,7 +172,7 @@ rc_logger_open(const char *level)
ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws); ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws);
if (openpty(&rc_logger_tty, &slave_tty, NULL, &tt, &ws)) if (openpty(&rc_logger_tty, &slave_tty, NULL, &tt, &ws))
return; return;
} else } else
if (openpty(&rc_logger_tty, &slave_tty, NULL, NULL, NULL)) if (openpty(&rc_logger_tty, &slave_tty, NULL, NULL, NULL))
return; return;

View File

@ -316,7 +316,7 @@ exec_service(const char *service, const char *arg)
fd = svc_lock(basename_c(service)); fd = svc_lock(basename_c(service));
if (fd == -1) if (fd == -1)
return -1; return -1;
file = rc_service_resolve(service); file = rc_service_resolve(service);
if (!exists(file)) { if (!exists(file)) {
rc_service_mark(service, RC_SERVICE_STOPPED); rc_service_mark(service, RC_SERVICE_STOPPED);

View File

@ -200,7 +200,7 @@ rc_plugin_run(RC_HOOK hook, const char *value)
sigaction(SIGUSR1, &sa, NULL); sigaction(SIGUSR1, &sa, NULL);
sigaction(SIGWINCH, &sa, NULL); sigaction(SIGWINCH, &sa, NULL);
sigprocmask(SIG_SETMASK, &old, NULL); sigprocmask(SIG_SETMASK, &old, NULL);
rc_in_plugin = true; rc_in_plugin = true;
close(pfd[0]); close(pfd[0]);
rc_environ_fd = fdopen(pfd[1], "w"); rc_environ_fd = fdopen(pfd[1], "w");

View File

@ -153,7 +153,7 @@ cleanup(void)
#ifdef DEBUG_MEMORY #ifdef DEBUG_MEMORY
while (p1) { while (p1) {
p2 = LIST_NEXT(p1, entries); p2 = LIST_NEXT(p1, entries);
free(p1); free(p1);
p1 = p2; p1 = p2;
} }
@ -315,7 +315,7 @@ open_shell(void)
{ {
const char *shell; const char *shell;
struct passwd *pw; struct passwd *pw;
#ifdef __linux__ #ifdef __linux__
const char *sys = rc_sys(); 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"); crashed = rc_conf_yesno("rc_crashed_stop");
nostop = rc_stringlist_split(rc_conf_value("rc_nostop"), " "); nostop = rc_stringlist_split(rc_conf_value("rc_nostop"), " ");
TAILQ_FOREACH_REVERSE(service, stop_services, rc_stringlist, entries) 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 * 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 * 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. */ * '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) { if(strcmp(basename_c(argv[0]), "rc") == 0 && strcmp(argv[1], "--applet") == 0) {
for(i = 2; i < argc; i++) for(i = 2; i < argc; i++)
argv[i-2] = argv[i]; argv[i-2] = argv[i];
argv[argc-2] = NULL; argv[argc-2] = NULL;
argv[argc-1] = NULL; argv[argc-1] = NULL;
argc -= 2; argc -= 2;

View File

@ -451,7 +451,7 @@ svc_exec(const char *arg1, const char *arg2)
signal_pipe[0] = signal_pipe[1] = -1; signal_pipe[0] = signal_pipe[1] = -1;
sigprocmask (SIG_SETMASK, &oldmask, NULL); sigprocmask (SIG_SETMASK, &oldmask, NULL);
if (master_tty >= 0) { if (master_tty >= 0) {
/* Why did we do this? */ /* Why did we do this? */
/* signal (SIGWINCH, SIG_IGN); */ /* signal (SIGWINCH, SIG_IGN); */
@ -572,7 +572,7 @@ svc_start_check(void)
RC_SERVICE state; RC_SERVICE state;
state = rc_service_state(service); state = rc_service_state(service);
if (in_background) { if (in_background) {
if (!(state & (RC_SERVICE_INACTIVE | RC_SERVICE_STOPPED))) if (!(state & (RC_SERVICE_INACTIVE | RC_SERVICE_STOPPED)))
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@ -583,7 +583,7 @@ svc_start_check(void)
" next runlevel", applet); " next runlevel", applet);
} }
if (exclusive_fd == -1) if (exclusive_fd == -1)
exclusive_fd = svc_lock(applet); exclusive_fd = svc_lock(applet);
if (exclusive_fd == -1) { if (exclusive_fd == -1) {
if (errno == EACCES) if (errno == EACCES)
@ -603,7 +603,7 @@ svc_start_check(void)
else if (state & RC_SERVICE_INACTIVE && !in_background) else if (state & RC_SERVICE_INACTIVE && !in_background)
ewarnx("WARNING: %s has already started, but is inactive", ewarnx("WARNING: %s has already started, but is inactive",
applet); applet);
rc_service_mark(service, RC_SERVICE_STARTING); rc_service_mark(service, RC_SERVICE_STARTING);
hook_out = RC_HOOK_SERVICE_START_OUT; hook_out = RC_HOOK_SERVICE_START_OUT;
rc_plugin_run(RC_HOOK_SERVICE_START_IN, applet); rc_plugin_run(RC_HOOK_SERVICE_START_IN, applet);
@ -619,7 +619,7 @@ svc_start_deps(void)
size_t len; size_t len;
char *p, *tmp; char *p, *tmp;
pid_t pid; pid_t pid;
errno = 0; errno = 0;
if (rc_conf_yesno("rc_depend_strict") || errno == ENOENT) if (rc_conf_yesno("rc_depend_strict") || errno == ENOENT)
depoptions |= RC_DEP_STRICT; depoptions |= RC_DEP_STRICT;
@ -725,7 +725,7 @@ svc_start_deps(void)
n = 0; n = 0;
TAILQ_FOREACH(svc, tmplist, entries) { TAILQ_FOREACH(svc, tmplist, entries) {
rc_service_schedule_start(svc->value, service); rc_service_schedule_start(svc->value, service);
use_services = rc_deptree_depend(deptree, use_services = rc_deptree_depend(deptree,
"iprovide", svc->value); "iprovide", svc->value);
TAILQ_FOREACH(svc2, use_services, entries) TAILQ_FOREACH(svc2, use_services, entries)
rc_service_schedule_start(svc2->value, service); rc_service_schedule_start(svc2->value, service);
@ -760,7 +760,7 @@ static void svc_start_real()
{ {
bool started; bool started;
RC_STRING *svc, *svc2; RC_STRING *svc, *svc2;
if (ibsave) if (ibsave)
setenv("IN_BACKGROUND", ibsave, 1); setenv("IN_BACKGROUND", ibsave, 1);
hook_out = RC_HOOK_SERVICE_START_DONE; hook_out = RC_HOOK_SERVICE_START_DONE;
@ -873,7 +873,7 @@ svc_stop_deps(RC_SERVICE state)
if (state & RC_SERVICE_WASINACTIVE) if (state & RC_SERVICE_WASINACTIVE)
return; return;
errno = 0; errno = 0;
if (rc_conf_yesno("rc_depend_strict") || errno == ENOENT) if (rc_conf_yesno("rc_depend_strict") || errno == ENOENT)
depoptions |= RC_DEP_STRICT; depoptions |= RC_DEP_STRICT;
@ -941,7 +941,7 @@ svc_stop_deps(RC_SERVICE state)
} }
rc_stringlist_free(tmplist); rc_stringlist_free(tmplist);
tmplist = NULL; tmplist = NULL;
/* We now wait for other services that may use us and are /* We now wait for other services that may use us and are
* stopping. This is important when a runlevel stops */ * stopping. This is important when a runlevel stops */
services = rc_deptree_depends(deptree, types_mua, applet_list, services = rc_deptree_depends(deptree, types_mua, applet_list,
@ -959,7 +959,7 @@ static void
svc_stop_real(void) svc_stop_real(void)
{ {
bool stopped; bool stopped;
/* If we're stopping localmount, set LC_ALL=C so that /* If we're stopping localmount, set LC_ALL=C so that
* bash doesn't load anything blocking the unmounting of /usr */ * bash doesn't load anything blocking the unmounting of /usr */
if (strcmp(applet, "localmount") == 0) if (strcmp(applet, "localmount") == 0)
@ -1138,7 +1138,7 @@ runscript(int argc, char **argv)
file = basename_c(argv[1]); file = basename_c(argv[1]);
else else
file = basename_c(lnk); file = basename_c(lnk);
dir = save; dir = save;
} else } else
file = basename_c(argv[1]); file = basename_c(argv[1]);
ll = strlen(dir) + strlen(file) + 2; ll = strlen(dir) + strlen(file) + 2;
@ -1206,7 +1206,7 @@ runscript(int argc, char **argv)
#endif #endif
deps = true; deps = true;
/* Punt the first arg as its our service name */ /* Punt the first arg as its our service name */
argc--; argc--;
argv++; argv++;
@ -1363,7 +1363,7 @@ runscript(int argc, char **argv)
RC_SERVICE_INACTIVE) RC_SERVICE_INACTIVE)
{ {
TAILQ_FOREACH(svc, TAILQ_FOREACH(svc,
restart_services, restart_services,
entries) entries)
if (rc_service_state(svc->value) & if (rc_service_state(svc->value) &
RC_SERVICE_STOPPED) RC_SERVICE_STOPPED)

View File

@ -322,7 +322,7 @@ get_pid(const char *pidfile, bool quiet)
fclose(fp); fclose(fp);
return -1; return -1;
} }
fclose(fp); fclose(fp);
return pid; return pid;
@ -631,7 +631,7 @@ static const struct option longopts[] = {
longopts_COMMON longopts_COMMON
}; };
static const char * const longopts_help[] = { static const char * const longopts_help[] = {
"Set an ionice class:data when starting", "Set an ionice class:data when starting",
"Stop daemon", "Stop daemon",
"Set a nicelevel when starting", "Set a nicelevel when starting",
"Retry schedule to use when stopping", "Retry schedule to use when stopping",
@ -1343,7 +1343,7 @@ start_stop_daemon(int argc, char **argv)
if (start_wait > 0) { if (start_wait > 0) {
struct timespec ts; struct timespec ts;
bool alive = false; bool alive = false;
ts.tv_sec = start_wait / 1000; ts.tv_sec = start_wait / 1000;
ts.tv_nsec = (start_wait % 1000) * ONE_MS; ts.tv_nsec = (start_wait % 1000) * ONE_MS;
if (nanosleep(&ts, NULL) == -1) { if (nanosleep(&ts, NULL) == -1) {