chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Prep v221: Update and clean up build system to sync with upstream
[elogind.git]
/
src
/
basic
/
rm-rf.c
diff --git
a/src/shared/rm-rf.c
b/src/basic/rm-rf.c
similarity index 97%
rename from
src/shared/rm-rf.c
rename to
src/basic/rm-rf.c
index d70e959d86011952f0b6d563fe6b635bddda2ec3..d35d172958fb6ea3f3cc154f72e5d3f3cfff9a76 100644
(file)
--- a/
src/shared/rm-rf.c
+++ b/
src/basic/rm-rf.c
@@
-21,6
+21,7
@@
#include "util.h"
#include "path-util.h"
#include "util.h"
#include "path-util.h"
+// #include "btrfs-util.h"
#include "rm-rf.h"
int rm_rf_children(int fd, RemoveFlags flags, struct stat *root_dev) {
#include "rm-rf.h"
int rm_rf_children(int fd, RemoveFlags flags, struct stat *root_dev) {
@@
-114,14
+115,14
@@
int rm_rf_children(int fd, RemoveFlags flags, struct stat *root_dev) {
safe_close(subdir_fd);
continue;
}
safe_close(subdir_fd);
continue;
}
+
#if 0
if ((flags & REMOVE_SUBVOLUME) && st.st_ino == 256) {
/* This could be a subvolume, try to remove it */
#if 0
if ((flags & REMOVE_SUBVOLUME) && st.st_ino == 256) {
/* This could be a subvolume, try to remove it */
-
r = btrfs_subvol_remove_fd(fd, de->d_name, true);
if (r < 0) {
r = btrfs_subvol_remove_fd(fd, de->d_name, true);
if (r < 0) {
-
if (r != -ENOTTY && r != -EINVAL) {
+ if (r != -ENOTTY && r != -EINVAL) {
if (ret == 0)
ret = r;
if (ret == 0)
ret = r;
@@
-137,8
+138,9
@@
int rm_rf_children(int fd, RemoveFlags flags, struct stat *root_dev) {
safe_close(subdir_fd);
continue;
}
safe_close(subdir_fd);
continue;
}
- }
-#endif //
+ }
+#endif // 0
+
/* We pass REMOVE_PHYSICAL here, to avoid
* doing the fstatfs() to check the file
* system type again for each directory */
/* We pass REMOVE_PHYSICAL here, to avoid
* doing the fstatfs() to check the file
* system type again for each directory */
@@
-174,19
+176,20
@@
int rm_rf(const char *path, RemoveFlags flags) {
log_error("Attempted to remove entire root file system, and we can't allow that.");
return -EPERM;
}
log_error("Attempted to remove entire root file system, and we can't allow that.");
return -EPERM;
}
-#if 0
+
if ((flags & (REMOVE_SUBVOLUME|REMOVE_ROOT|REMOVE_PHYSICAL)) == (REMOVE_SUBVOLUME|REMOVE_ROOT|REMOVE_PHYSICAL)) {
/* Try to remove as subvolume first */
if ((flags & (REMOVE_SUBVOLUME|REMOVE_ROOT|REMOVE_PHYSICAL)) == (REMOVE_SUBVOLUME|REMOVE_ROOT|REMOVE_PHYSICAL)) {
/* Try to remove as subvolume first */
- r = btrfs_subvol_remove(path, true);
+#if 0
+ r = btrfs_subvol_remove(path, true);
if (r >= 0)
return r;
if (r >= 0)
return r;
- if (r != -ENOTTY && r != -EINVAL)
+ if (r != -ENOTTY && r != -EINVAL
&& r != -ENOTDIR
)
return r;
return r;
-
+#endif // 0
/* Not btrfs or not a subvolume */
}
/* Not btrfs or not a subvolume */
}
-#endif // 0
+
fd = open(path, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW|O_NOATIME);
if (fd < 0) {
fd = open(path, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW|O_NOATIME);
if (fd < 0) {