summaryrefslogtreecommitdiffstats
path: root/src/shared/rm-rf.h
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2023-06-01 14:36:47 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2023-06-06 14:42:03 +0200
commit5124aa8c03ae4e6d0c33de9beea6e81554b22030 (patch)
tree45ea1204215ff57d84644f0044fc8de459feb84f /src/shared/rm-rf.h
parentbtrfs-util: Add btrfs_subvol_remove_at() (diff)
downloadsystemd-5124aa8c03ae4e6d0c33de9beea6e81554b22030.tar.xz
systemd-5124aa8c03ae4e6d0c33de9beea6e81554b22030.zip
rm-rf: Add rm_rf_at()
Diffstat (limited to 'src/shared/rm-rf.h')
-rw-r--r--src/shared/rm-rf.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/shared/rm-rf.h b/src/shared/rm-rf.h
index 24fd9a2aa2..9d93692e0a 100644
--- a/src/shared/rm-rf.h
+++ b/src/shared/rm-rf.h
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include <fcntl.h>
#include <sys/stat.h>
#include "alloc-util.h"
@@ -26,7 +27,10 @@ int fstatat_harder(int dfd,
int rm_rf_children(int fd, RemoveFlags flags, const struct stat *root_dev);
int rm_rf_child(int fd, const char *name, RemoveFlags flags);
-int rm_rf(const char *path, RemoveFlags flags);
+int rm_rf_at(int dir_fd, const char *path, RemoveFlags flags);
+static inline int rm_rf(const char *path, RemoveFlags flags) {
+ return rm_rf_at(AT_FDCWD, path, flags);
+}
/* Useful for usage with _cleanup_(), destroys a directory and frees the pointer */
static inline char *rm_rf_physical_and_free(char *p) {