mirror of
https://github.com/troglobit/finit.git
synced 2026-10-07 16:14:21 +07:00
Silence non-critical failure to remove /run/finit/cond/ at reboot
The directory may hold various custom generated conditions that are not managed by Finit. Not being able to remove the directory is not a critical error. finit[1]: cond_delpath():Failed removing condition path /var/run/finit/cond/: Directory not empty Therefore, ignore ENOENT and ENOTEMPTY and log everything/anything else. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
+10
-2
@@ -222,8 +222,16 @@ static int do_delete(const char *fpath, const struct stat *sb, int tflag, struct
|
||||
static void cond_delpath(const char *path)
|
||||
{
|
||||
nftw(path, do_delete, 20, FTW_DEPTH);
|
||||
if (remove(path) && errno != ENOENT)
|
||||
err(1, "Failed removing condition path %s", path);
|
||||
if (remove(path)) {
|
||||
switch (errno) {
|
||||
case ENOENT: /* Ignore */
|
||||
case ENOTEMPTY: /* Only at shutdown and for directories */
|
||||
break;
|
||||
default:
|
||||
err(1, "Failed removing condition path %s", path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int cond_set_path(const char *path, enum cond_state next)
|
||||
|
||||
Reference in New Issue
Block a user