cryptsetup-generator: unconfuse writing of the device timeout
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 3 Dec 2019 15:06:47 +0000 (16:06 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 5 Feb 2020 13:07:28 +0000 (14:07 +0100)
commitdc56b94e13089bbabcf75d962a11fec26b829093
tree781762da31dd1569b846c9bf7bd85f9aa413c960
parent0757ad565573ad96ad8c3b4957ecf850fcc97042
cryptsetup-generator: unconfuse writing of the device timeout

The code was using timeout=0 as the default option string. This option string
was ultimately passed to generator_write_timeouts(), which only looks for
comment=systemd.device-timeout= or x-systemd.device-timeout=, i.e. the whole
call path was bogus. Let's rework this: generator_write_timeouts() now writes
any timeouts if configured by the user. create_disk() writes out it's own
timeout, but with lower priority. Since the code path that was calling
timeout=0 was not effective, the only change is that we stop overwriting the
timeout if explicitly configured by the user.

In both code paths, ignore failure to write.

(cherry picked from commit 7cecc563163f539c497ecdf5ab00729fcd8c97c1)
src/cryptsetup/cryptsetup-generator.c
src/shared/generator.c