summaryrefslogtreecommitdiff
path: root/src/cryptsetup/cryptsetup.c
diff options
context:
space:
mode:
authorMantas Mikulėnas <grawity@gmail.com>2016-04-01 21:51:20 +0300
committerLennart Poettering <lennart@poettering.net>2016-04-01 20:51:20 +0200
commita0bfc9c26a2cc44b95b1a02200cb999dedf9c0c3 (patch)
tree924880066b68c952d88e0129f35ed9b662c9dfea /src/cryptsetup/cryptsetup.c
parent7aa610f1491fd361c269481701c9d07ac3f48ae6 (diff)
cryptsetup: do not 'fail' if trying to detach a nonexistent device
It could be that our .service is being stopped precisely because the device already disappeared (e.g. due to a manual `cryptsetup close`, or due to UDisks2 cleaning up).
Diffstat (limited to 'src/cryptsetup/cryptsetup.c')
-rw-r--r--src/cryptsetup/cryptsetup.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 2ef966257a..9927621ea0 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -719,8 +719,12 @@ int main(int argc, char *argv[]) {
int k;
k = crypt_init_by_name(&cd, argv[2]);
- if (k) {
- log_error_errno(k, "crypt_init() failed: %m");
+ if (k == -ENODEV) {
+ log_info("Volume %s already inactive.", argv[2]);
+ r = EXIT_SUCCESS;
+ goto finish;
+ } else if (k) {
+ log_error_errno(k, "crypt_init_by_name() failed: %m");
goto finish;
}