shared/dissect-image: log messages from cryptsetup
authorTopi Miettinen <toiwoton@gmail.com>
Thu, 2 Apr 2020 13:57:26 +0000 (16:57 +0300)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 17 Apr 2020 10:27:54 +0000 (12:27 +0200)
Before:
```
write(2, "Device /dev/loop1p1 is too small.\n", 34) = -1 ENOTCONN (Transport
endpoint is not connected)
```

After:
```
$ journalctl -b -e | grep 'too small'
Apr 02 16:53:30 loora systemd[343579]: Device /dev/loop1p1 is too small.
```

(cherry picked from commit 1887032f71b00e51d04bb5ae1860d581da786154)

src/shared/dissect-image.c

index 1ef69fdf4c8d3bc47a1563bb609a227c9fd4af3d..34b6d44b479347fbacabb697493d5e97f24ee5c5 100644 (file)
@@ -1188,6 +1188,8 @@ static int decrypt_partition(
         if (r < 0)
                 return log_debug_errno(r, "Failed to initialize dm-crypt: %m");
 
+        crypt_set_log_callback(cd, cryptsetup_log_glue, NULL);
+
         r = crypt_load(cd, CRYPT_LUKS, NULL);
         if (r < 0)
                 return log_debug_errno(r, "Failed to load LUKS metadata: %m");
@@ -1246,6 +1248,8 @@ static int verity_partition(
         if (r < 0)
                 return r;
 
+        crypt_set_log_callback(cd, cryptsetup_log_glue, NULL);
+
         r = crypt_load(cd, CRYPT_VERITY, NULL);
         if (r < 0)
                 return r;