summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2021-12-17 19:10:38 +0000
committerTimo Teräs <timo.teras@iki.fi>2022-02-14 17:18:54 +0000
commitaa4880bc046af5ce30b226adbc0ce88fd2b0ae7f (patch)
tree12a5b4740257a95e09a6233960d1e584cf86531b
parent4c568416e31b9ec6d1bd50ff8198a2c2e2ab71ff (diff)
downloadapk-tools-aa4880bc046af5ce30b226adbc0ce88fd2b0ae7f.tar.gz
apk-tools-aa4880bc046af5ce30b226adbc0ce88fd2b0ae7f.tar.bz2
apk-tools-aa4880bc046af5ce30b226adbc0ce88fd2b0ae7f.tar.xz
apk-tools-aa4880bc046af5ce30b226adbc0ce88fd2b0ae7f.zip
fs_uvol: take down volume before removal
Make sure volume is in 'down' state before attempting to remove it. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r--src/fs_uvol.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/fs_uvol.c b/src/fs_uvol.c
index ec6fc35..d00cdc8 100644
--- a/src/fs_uvol.c
+++ b/src/fs_uvol.c
@@ -128,6 +128,7 @@ static int uvol_file_control(struct apk_fsdir *d, apk_blob_t filename, int ctrl)
struct apk_ctx *ac = d->ac;
struct apk_pathbuilder pb;
const char *uvol_name;
+ int r;
if (IS_ERR(ac->uvol)) return PTR_ERR(ac->uvol);
@@ -140,6 +141,9 @@ static int uvol_file_control(struct apk_fsdir *d, apk_blob_t filename, int ctrl)
case APK_FS_CTRL_APKNEW:
case APK_FS_CTRL_CANCEL:
case APK_FS_CTRL_DELETE:
+ r = uvol_run(ac, "down", uvol_name, 0, 0);
+ if (r)
+ return r;
return uvol_run(ac, "remove", uvol_name, 0, 0);
default:
return -APKE_UVOL_ERROR;