paranoia: refuse rm_rf("/")
This commit is contained in:
parent
8401e9f91d
commit
461b182232
4
TODO
4
TODO
|
@ -22,6 +22,10 @@ Bugfixes:
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
|
|
||||||
|
* refuse taking lower-case variable names in sd_journal_send() and friends.
|
||||||
|
|
||||||
|
* when running as user instance: implicitly default to WorkingDirectory=$HOME for all services.
|
||||||
|
|
||||||
* journalctl highlight reboots
|
* journalctl highlight reboots
|
||||||
|
|
||||||
* Merge KillUnit()'s mode and who params into one
|
* Merge KillUnit()'s mode and who params into one
|
||||||
|
|
|
@ -2058,7 +2058,6 @@ static int system_journal_open(Server *s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int server_flush_to_var(Server *s) {
|
static int server_flush_to_var(Server *s) {
|
||||||
char path[] = "/run/log/journal/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
|
||||||
Object *o = NULL;
|
Object *o = NULL;
|
||||||
int r;
|
int r;
|
||||||
sd_id128_t machine;
|
sd_id128_t machine;
|
||||||
|
@ -2135,6 +2134,7 @@ finish:
|
||||||
s->runtime_journal = NULL;
|
s->runtime_journal = NULL;
|
||||||
|
|
||||||
if (r >= 0) {
|
if (r >= 0) {
|
||||||
|
char path[] = "/run/log/journal/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
||||||
sd_id128_to_string(machine, path + 17);
|
sd_id128_to_string(machine, path + 17);
|
||||||
rm_rf(path, false, true, false);
|
rm_rf(path, false, true, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3339,6 +3339,9 @@ int rm_rf(const char *path, bool only_dirs, bool delete_root, bool honour_sticky
|
||||||
|
|
||||||
assert(path);
|
assert(path);
|
||||||
|
|
||||||
|
/* Be paranoid */
|
||||||
|
assert(!streq(path, "/"));
|
||||||
|
|
||||||
fd = open(path, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW|O_NOATIME);
|
fd = open(path, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW|O_NOATIME);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue