Allow time for pidfiles to be created, #178274.
Use int instead of char for getopt, #178084 thanks to drizztbsd.
This commit is contained in:
parent
86c7d44d66
commit
0942916b72
@ -1,6 +1,11 @@
|
||||
# ChangeLog for Gentoo System Intialization ("rc") scripts
|
||||
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2
|
||||
|
||||
14 May 2007; Roy Marples <uberlord@gentoo.org>:
|
||||
|
||||
Allow time for pidfiles to be created, #178274.
|
||||
Use int instead of char for getopt, #178084 thanks to drizztbsd.
|
||||
|
||||
11 May 2007; Roy Marples <uberlord@gentoo.org>:
|
||||
|
||||
Store the defined random pool size, #177722 thanks to Yaroslav Isakov.
|
||||
|
@ -70,7 +70,7 @@ LDLIBS_RS = -ldl
|
||||
override CPPFLAGS += -D_GNU_SOURCE
|
||||
endif
|
||||
ifeq ($(OS),BSD)
|
||||
override LDLIBS += -lkvm
|
||||
LDLIBS_LIBRC = -lkvm
|
||||
endif
|
||||
|
||||
HAVE_PAM =
|
||||
@ -102,7 +102,7 @@ $(LIBEINFOSO): $(LIBEINFOOBJS)
|
||||
|
||||
$(LIBRCOBJS): CFLAGS += -fPIC
|
||||
$(LIBRCSO): $(LIBRCOBJS)
|
||||
$(CC) -fPIC -shared -Wl,-soname,$(LIBRCSO) -o $(LIBRCSO) $(LIBRCOBJS)
|
||||
$(CC) -fPIC -shared -Wl,-soname,$(LIBRCSO) -o $(LIBRCSO) $(LDLIBS_LIBRC) $(LIBRCOBJS)
|
||||
ln -sf $(LIBRCSO) librc.so
|
||||
|
||||
env-update: $(LIBEINFOSO) $(LIBRCSO) env-update.o
|
||||
|
@ -78,15 +78,15 @@ int main (int argc, char **argv)
|
||||
int result = EXIT_FAILURE;
|
||||
char *token;
|
||||
int n = 0;
|
||||
char c;
|
||||
int opt;
|
||||
|
||||
while ((c = getopt_long (argc, argv, getoptstring,
|
||||
longopts, (int *) 0)) != -1)
|
||||
while ((opt = getopt_long (argc, argv, getoptstring,
|
||||
longopts, (int *) 0)) != -1)
|
||||
{
|
||||
#ifdef HAVE_GETMNTENT
|
||||
fp = setmntent ("/etc/fstab", "r");
|
||||
#endif
|
||||
switch (c) {
|
||||
switch (opt) {
|
||||
case 'f':
|
||||
while ((token = strsep (&optarg, ",")))
|
||||
while ((ent = GET_ENT))
|
||||
|
@ -157,11 +157,11 @@ int main (int argc, char **argv)
|
||||
bool list_fstype = false;
|
||||
bool reverse = false;
|
||||
char **mounts = NULL;
|
||||
char c;
|
||||
int opt;
|
||||
|
||||
while ((c = getopt_long (argc, argv, getoptstring,
|
||||
longopts, (int *) 0)) != -1)
|
||||
switch (c) {
|
||||
while ((opt = getopt_long (argc, argv, getoptstring,
|
||||
longopts, (int *) 0)) != -1)
|
||||
switch (opt) {
|
||||
case 'F':
|
||||
if (fstype_regex)
|
||||
free (fstype_regex);
|
||||
|
@ -70,13 +70,12 @@ int main (int argc, char **argv)
|
||||
char **services = NULL;
|
||||
char *level;
|
||||
char *service;
|
||||
char c;
|
||||
int option_index = 0;
|
||||
int opt;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
while ((c = getopt_long(argc, argv, getoptstring, longopts, &option_index)) != -1)
|
||||
switch (c) {
|
||||
while ((opt = getopt_long(argc, argv, getoptstring, longopts, (int *) 0)) != -1)
|
||||
switch (opt) {
|
||||
case 'a':
|
||||
levels = rc_get_runlevels ();
|
||||
break;
|
||||
|
@ -972,7 +972,7 @@ int main (int argc, char **argv)
|
||||
bool doneone = false;
|
||||
char pid[16];
|
||||
int retval;
|
||||
char c;
|
||||
int opt;
|
||||
|
||||
service = argv[1];
|
||||
/* Show help if insufficient args */
|
||||
@ -1079,9 +1079,9 @@ int main (int argc, char **argv)
|
||||
argv++;
|
||||
|
||||
/* Right then, parse any options there may be */
|
||||
while ((c = getopt_long (argc, argv, getoptstring,
|
||||
longopts, (int *) 0)) != -1)
|
||||
switch (c) {
|
||||
while ((opt = getopt_long (argc, argv, getoptstring,
|
||||
longopts, (int *) 0)) != -1)
|
||||
switch (opt) {
|
||||
case 'd':
|
||||
setenv ("RC_DEBUG", "yes", 1);
|
||||
break;
|
||||
|
@ -500,7 +500,7 @@ int main (int argc, char **argv)
|
||||
{ "stderr", 1, NULL, '2'},
|
||||
{ NULL, 0, NULL, 0}
|
||||
};
|
||||
int c;
|
||||
int opt;
|
||||
bool start = false;
|
||||
bool stop = false;
|
||||
bool oknodo = false;
|
||||
@ -541,10 +541,10 @@ int main (int argc, char **argv)
|
||||
if (sscanf (env, "%d", &nicelevel) != 1)
|
||||
eerror ("%s: invalid nice level `%s' (SSD_NICELEVEL)", progname, env);
|
||||
|
||||
while ((c = getopt_long (argc, argv,
|
||||
"KN:R:Sbc:d:g:mn:op:qs:tu:r:vx:1:2:",
|
||||
longopts, (int *) 0)) != -1)
|
||||
switch (c) {
|
||||
while ((opt = getopt_long (argc, argv,
|
||||
"KN:R:Sbc:d:g:mn:op:qs:tu:r:vx:1:2:",
|
||||
longopts, (int *) 0)) != -1)
|
||||
switch (opt) {
|
||||
case 'K': /* --stop */
|
||||
stop = true;
|
||||
break;
|
||||
@ -962,6 +962,7 @@ int main (int argc, char **argv)
|
||||
if (START_WAIT > 0) {
|
||||
struct timeval stopat;
|
||||
struct timeval now;
|
||||
bool retestpid = false;
|
||||
|
||||
if (gettimeofday (&stopat, NULL) != 0)
|
||||
eerrorx ("%s: gettimeofday: %s", progname, strerror (errno));
|
||||
@ -991,11 +992,20 @@ int main (int argc, char **argv)
|
||||
if (kill (pid, 0) == 0)
|
||||
alive = true;
|
||||
} else {
|
||||
if (pidfile && rc_exists (pidfile)) {
|
||||
if (do_stop (NULL, NULL, pidfile, uid, 0, true, false, true) > 0)
|
||||
if (pidfile) {
|
||||
/* The pidfile may not have been written yet - give it some time */
|
||||
if (get_pid (pidfile, true) == -1) {
|
||||
alive = true;
|
||||
retestpid = true;
|
||||
} else {
|
||||
retestpid = false;
|
||||
if (do_stop (NULL, NULL, pidfile, uid, 0,
|
||||
true, false, true) > 0)
|
||||
alive = true;
|
||||
}
|
||||
} else {
|
||||
if (do_stop (exec, cmd, NULL, uid, 0, true, false, true) > 0)
|
||||
if (do_stop (exec, cmd, NULL, uid, 0, true, false, true)
|
||||
> 0)
|
||||
alive = true;
|
||||
}
|
||||
}
|
||||
@ -1006,6 +1016,12 @@ int main (int argc, char **argv)
|
||||
if (timercmp (&now, &stopat, >))
|
||||
break;
|
||||
}
|
||||
|
||||
if (retestpid) {
|
||||
if (do_stop (NULL, NULL, pidfile, uid, 0, true,
|
||||
false, true) < 1)
|
||||
eerrorx ("%s: %s died", progname, exec);
|
||||
}
|
||||
}
|
||||
|
||||
if (svcname)
|
||||
|
Loading…
Reference in New Issue
Block a user