]> git.ipfire.org Git - thirdparty/systemd.git/commit
fsck: don't apply invalid mode or repair values
authordongshengyuan <545258830@qq.com>
Wed, 8 Jul 2026 08:53:30 +0000 (16:53 +0800)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 8 Jul 2026 11:13:43 +0000 (12:13 +0100)
commitda9a330dfd41e91cbfa6a6def2abb3706e280aa4
tree13868598d332face419da28c303bd1437d65f5ca
parent1b0330399827696f1818ba8515217e2fe5350656
fsck: don't apply invalid mode or repair values

fsck_mode_from_string() and fsck_repair_from_string() return -EINVAL
on a bad value. Store the result in a local variable first, and only
update the global state on success.

Otherwise an invalid value is logged as ignored, but still leaves a
negative enum value behind. In the fsck.repair case that makes
fsck_repair_option_to_string() return NULL and truncates the fsck
command line.

Follow-up for a85428b1d325654dc7e1afbabf4b689bd31116f5
Follow-up for 059afcadfd89c6c302f20c9ac1a1c44592b716df

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
src/fsck/fsck.c