]> git.ipfire.org Git - thirdparty/shadow.git/commit
useradd: fix btrfs subvolume creation for single-component basedir master
authorHadi Chokr <hadichokr@icloud.com>
Tue, 28 Apr 2026 10:18:43 +0000 (12:18 +0200)
committerAlejandro Colomar <foss+github@alejandro-colomar.es>
Tue, 28 Apr 2026 13:32:50 +0000 (15:32 +0200)
commitbd1ea38423231d7735f648d80db0016ec2ba760e
tree5bcb991adaafdbd2ef433e06eee8adb199523c9c
parent49ff9bf33a7b6af57cb26688c3139f014302c9d9
useradd: fix btrfs subvolume creation for single-component basedir

dirname() replaces broken stpcpy index arithmetic that produced an
empty string for single-component paths (e.g. /koolhome), causing
statfs to fail and fall back to a regular directory. Use path in
the error message since dirname() modifies btrfs_check in-place,
making it unusable for logging after the call.

Fixes: c1d36a8acb1d (2019-05-04; "Add support for btrfs subvolumes for user homes")
Signed-off-by: Hadi Chokr <hadichokr@icloud.com>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
src/useradd.c