Clean up all trailing whitespace in src/.
This commit is contained in:
parent
49339525a9
commit
e6fc30da61
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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 **);
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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));
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
|
12
src/rc/rc.c
12
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;
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user