diff options
author | Roy Marples <roy@marples.name> | 2007-10-05 10:36:53 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2007-10-05 10:36:53 +0000 |
commit | 3bfba57f5b2d89a5022fac932e46ca467a4b9f26 (patch) | |
tree | c730a290d7c3c261db1d8bdf65f1662e749ecaf8 /src/rc.c | |
parent | 05b8eff319536ade894d07705bc74abaf425788e (diff) |
Punt rc_rm_dir
Diffstat (limited to 'src/rc.c')
-rw-r--r-- | src/rc.c | 34 |
1 files changed, 32 insertions, 2 deletions
@@ -1026,7 +1026,24 @@ int main (int argc, char **argv) eerrorx ("failed to load deptree"); /* Clean the failed services state dir now */ - rc_rm_dir (RC_SVCDIR "/failed", false); + if ((dp = opendir (RC_SVCDIR "/failed"))) { + while ((d = readdir (dp))) { + if (d->d_name[0] == '.' && + (d->d_name[1] == '\0' || + (d->d_name[1] == '.' && d->d_name[2] == '\0'))) + continue; + + asprintf (&tmp, RC_SVCDIR "/failed/%s", d->d_name); + if (tmp) { + if (unlink (tmp)) + eerror ("%s: unlink `%s': %s", applet, tmp, + strerror (errno)); + free (tmp); + } + } + closedir (dp); + rmdir (RC_SVCDIR "/failed"); + } mkdir (RC_STOPPING, 0755); @@ -1037,12 +1054,25 @@ int main (int argc, char **argv) here when we are ready for them */ if ((dp = opendir (DEVBOOT))) { while ((d = readdir (dp))) { + if (d->d_name[0] == '.' && + (d->d_name[1] == '\0' || + (d->d_name[1] == '.' && d->d_name[2] == '\0'))) + continue; + if (rc_service_exists (d->d_name) && rc_service_plugable (d->d_name)) rc_service_mark (d->d_name, RC_SERVICE_COLDPLUGGED); + + tmp = asprintf (&tmp, RC_SVCDIR "/failed/%s", d->d_name); + if (tmp) { + if (unlink (tmp)) + eerror ("%s: unlink `%s': %s", applet, tmp, + strerror (errno)); + free (tmp); + } } closedir (dp); - rc_rm_dir (DEVBOOT, true); + rmdir (DEVBOOT); } #else /* BSD's on the other hand populate /dev automagically and use devd. |