Don't timeout waiting for checkfs and checkroot. Do a better fix later.

This commit is contained in:
Roy Marples 2007-05-02 15:17:03 +00:00
parent 9ced77155b
commit e18377acca
2 changed files with 31 additions and 15 deletions

View File

@ -569,21 +569,33 @@ librc_hidden_def(rc_schedule_clear)
bool rc_wait_service (const char *service) bool rc_wait_service (const char *service)
{ {
char *svc = rc_xstrdup (service); char *svc;
char *fifo = rc_strcatpaths (RC_SVCDIR, "exclusive", basename (svc), char *base;
(char *) NULL); char *fifo;
struct timeval tv; struct timeval tv;
struct timeval stopat; struct timeval stopat;
struct timeval now; struct timeval now;
bool retval = false; bool retval = false;
bool forever = false;
if (! service)
return (false);
free (svc);
if (gettimeofday (&stopat, NULL) != 0) { if (gettimeofday (&stopat, NULL) != 0) {
eerror ("gettimeofday: %s", strerror (errno)); eerror ("gettimeofday: %s", strerror (errno));
return (false); return (false);
} }
stopat.tv_sec += WAIT_MAX; stopat.tv_sec += WAIT_MAX;
svc = rc_xstrdup (service);
base = basename (svc);
fifo = rc_strcatpaths (RC_SVCDIR, "exclusive", base, (char *) NULL);
/* FIXME: find a better way of doing this
* Maybe a setting in the init script? */
if (strcmp (base, "checkfs") == 0 || strcmp (base, "checkroot") == 0)
forever = true;
free (svc);
while (true) { while (true) {
if (! rc_exists (fifo)) { if (! rc_exists (fifo)) {
retval = true; retval = true;
@ -599,6 +611,7 @@ bool rc_wait_service (const char *service)
} }
} }
if (! forever) {
/* Don't hang around forever */ /* Don't hang around forever */
if (gettimeofday (&now, NULL) != 0) { if (gettimeofday (&now, NULL) != 0) {
eerror ("gettimeofday: %s", strerror (errno)); eerror ("gettimeofday: %s", strerror (errno));
@ -608,6 +621,7 @@ bool rc_wait_service (const char *service)
if (timercmp (&now, &stopat, >)) if (timercmp (&now, &stopat, >))
break; break;
} }
}
free (fifo); free (fifo);
return (retval); return (retval);

View File

@ -546,7 +546,9 @@ static void handle_signal (int sig)
/* Only drop into single user mode if we're booting */ /* Only drop into single user mode if we're booting */
run = getenv ("RUNLEVEL"); run = getenv ("RUNLEVEL");
prev = getenv ("PREVLEVEL"); prev = getenv ("PREVLEVEL");
if ((prev && strcmp (prev, "S") == 0) || if ((prev &&
(strcmp (prev, "S") == 0 ||
strcmp (prev, "1") == 0)) ||
(run && (run &&
(strcmp (run, "S") == 0 || (strcmp (run, "S") == 0 ||
strcmp (run, "1") == 0))) strcmp (run, "1") == 0)))