diff options
-rw-r--r-- | src/firejail/appimage.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/firejail/appimage.c b/src/firejail/appimage.c index d654e51fc..375d6be24 100644 --- a/src/firejail/appimage.c +++ b/src/firejail/appimage.c | |||
@@ -126,16 +126,32 @@ void appimage_set(const char *appimage_path) { | |||
126 | void appimage_clear(void) { | 126 | void appimage_clear(void) { |
127 | int rv; | 127 | int rv; |
128 | 128 | ||
129 | EUID_ROOT(); | ||
129 | if (mntdir) { | 130 | if (mntdir) { |
130 | rv = umount2(mntdir, MNT_FORCE); | 131 | int i; |
131 | if (rv == -1 && errno == EBUSY) { | 132 | int rv = 0; |
132 | sleep(5); | 133 | for (i = 0; i < 5; i++) { |
133 | rv = umount2(mntdir, MNT_FORCE); | 134 | rv = umount2(mntdir, MNT_FORCE); |
134 | (void) rv; | 135 | if (rv == 0) |
136 | break; | ||
137 | if (rv == -1 && errno == EBUSY) { | ||
138 | if (!arg_quiet) | ||
139 | printf("Warning: EBUSY error trying to unmount %s\n", mntdir); | ||
140 | sleep(2); | ||
141 | continue; | ||
142 | } | ||
135 | 143 | ||
144 | // rv = -1 | ||
145 | if (!arg_quiet) { | ||
146 | printf("Warning: error trying to unmount %s\n", mntdir); | ||
147 | perror("umount"); | ||
148 | } | ||
149 | } | ||
150 | |||
151 | if (rv == 0) { | ||
152 | rmdir(mntdir); | ||
153 | free(mntdir); | ||
136 | } | 154 | } |
137 | rmdir(mntdir); | ||
138 | free(mntdir); | ||
139 | } | 155 | } |
140 | 156 | ||
141 | if (devloop) { | 157 | if (devloop) { |