aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_linux.h
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-08-08 19:55:34 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-08-09 16:05:46 +0200
commitacf31536e9e570b2a5ee11a7818c96e4d177c808 (patch)
treed70ccf562c270bd4529bf0e5d16c6e7923c5447f /executor/common_linux.h
parent23b45a752503bd94a83d78ada7d19576d5f95a7d (diff)
executor: clean up immutable dirs
Turns out dirs can be immutable too. Update #650
Diffstat (limited to 'executor/common_linux.h')
-rw-r--r--executor/common_linux.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h
index 53684f646..49c33c108 100644
--- a/executor/common_linux.h
+++ b/executor/common_linux.h
@@ -1825,6 +1825,17 @@ retry:
if (rmdir(dir) == 0)
break;
if (i < 100) {
+ if (errno == EPERM) {
+ // Try to reset FS_XFLAG_IMMUTABLE.
+ int fd = open(dir, O_RDONLY);
+ if (fd != -1) {
+ struct fsxattr attr = {0};
+ if (ioctl(fd, FS_IOC_FSSETXATTR, &attr) == 0)
+ debug("reset FS_XFLAG_IMMUTABLE\n");
+ close(fd);
+ continue;
+ }
+ }
if (errno == EROFS) {
debug("ignoring EROFS\n");
break;