aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-05-02 15:17:03 +0000
committerRoy Marples <roy@marples.name>2007-05-02 15:17:03 +0000
commite18377accad411d21f28cbd11e014a047c9946cc (patch)
treed4c3d5dad7218dbc1d060f09208d09bd84b53023
parent9ced77155ba7d143fa18c3645dc84b55b97c7b04 (diff)
Don't timeout waiting for checkfs and checkroot. Do a better fix later.
-rw-r--r--src/librc.c36
-rw-r--r--src/rc.c10
2 files changed, 31 insertions, 15 deletions
diff --git a/src/librc.c b/src/librc.c
index 7199cd9b..67a4174d 100644
--- a/src/librc.c
+++ b/src/librc.c
@@ -569,21 +569,33 @@ librc_hidden_def(rc_schedule_clear)
bool rc_wait_service (const char *service)
{
- char *svc = rc_xstrdup (service);
- char *fifo = rc_strcatpaths (RC_SVCDIR, "exclusive", basename (svc),
- (char *) NULL);
+ char *svc;
+ char *base;
+ char *fifo;
struct timeval tv;
struct timeval stopat;
struct timeval now;
bool retval = false;
+ bool forever = false;
+
+ if (! service)
+ return (false);
- free (svc);
if (gettimeofday (&stopat, NULL) != 0) {
eerror ("gettimeofday: %s", strerror (errno));
return (false);
}
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) {
if (! rc_exists (fifo)) {
retval = true;
@@ -599,14 +611,16 @@ bool rc_wait_service (const char *service)
}
}
- /* Don't hang around forever */
- if (gettimeofday (&now, NULL) != 0) {
- eerror ("gettimeofday: %s", strerror (errno));
- break;
- }
+ if (! forever) {
+ /* Don't hang around forever */
+ if (gettimeofday (&now, NULL) != 0) {
+ eerror ("gettimeofday: %s", strerror (errno));
+ break;
+ }
- if (timercmp (&now, &stopat, >))
- break;
+ if (timercmp (&now, &stopat, >))
+ break;
+ }
}
free (fifo);
diff --git a/src/rc.c b/src/rc.c
index 6b864ce0..0ecbb020 100644
--- a/src/rc.c
+++ b/src/rc.c
@@ -546,10 +546,12 @@ static void handle_signal (int sig)
/* Only drop into single user mode if we're booting */
run = getenv ("RUNLEVEL");
prev = getenv ("PREVLEVEL");
- if ((prev && strcmp (prev, "S") == 0) ||
- (run &&
- (strcmp (run, "S") == 0 ||
- strcmp (run, "1") == 0)))
+ if ((prev &&
+ (strcmp (prev, "S") == 0 ||
+ strcmp (prev, "1") == 0)) ||
+ (run &&
+ (strcmp (run, "S") == 0 ||
+ strcmp (run, "1") == 0)))
single_user ();
exit (EXIT_FAILURE);