]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/basic/rm-rf.c
rm-rf: introduce new flag REMOVE_MISSING_OK
authorLennart Poettering <lennart@poettering.net>
Fri, 29 Mar 2019 15:13:03 +0000 (16:13 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 11 Jul 2019 10:18:51 +0000 (12:18 +0200)
commitc0228b4fa3e4e633afa5eb8417e6cd3e311cd250
treec3d9590862e8b6ff68f3dd790f5f853a0e3ef666
parent6b39223cd3d5af24c0077207c633a47ae8f7d80d
rm-rf: introduce new flag REMOVE_MISSING_OK

This new flag suppresses error if the top-level path specified doesn't
exist. This is useful since suppressing this on the caller side isn't
easy, since ENOENT migh be propagate for some reason from further inside
and we can't distuingish that.

While we are at it, also be a bit more careful witht the various
combinations of flags.

(Note that in some cases rm_rf() was already ignoring ENOENT from
unlink() or rmdir(), however that was pretty useless, since we always
open() the top-level path with O_DIRECTORY and if that hit ENOENT we
didn't ignore the failure).
src/basic/rm-rf.c
src/basic/rm-rf.h