basic/lock-util: log correct error

lock_generic() returns a negative errno; the message relied on errno still
holding the value of the underlying call.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek committed 2026-11-04 00:33:24 +01:00
1 parent c7542b29bc
commit 81f76a0dde
1 file changed
+3 -2
+3 -2
View File
@@ -226,8 +226,9 @@ int lock_generic_with_timeout(int fd, LockType type, int operation, usec_t timeo
if (r < 0)
return log_error_errno(r, "Failed to flock block device in child process: %m");
if (r == 0) {
if (lock_generic(fd, type, operation) < 0) {
log_error_errno(errno, "Unable to get an exclusive lock on the device: %m");
r = lock_generic(fd, type, operation);
if (r < 0) {
log_error_errno(r, "Unable to get an exclusive lock on the device: %m");
_exit(EXIT_FAILURE);
}