32 lines
1001 B
Diff
32 lines
1001 B
Diff
From 713310b93d85ffd01aae26f3d878a8b0453fa506 Mon Sep 17 00:00:00 2001
|
|
From: Zdenek Kabelac <zkabelac@redhat.com>
|
|
Date: Wed, 29 Jan 2025 00:00:23 +0100
|
|
Subject: [PATCH] config: check for 0 from read
|
|
|
|
When the read returns 0, it could mean the file
|
|
was trimmed or some other type of problem.
|
|
In this case abort the potentially endless loop.
|
|
|
|
Reference: https://github.com/lvmteam/lvm2/commit/e907c3cf9a1c294b6551d525d58f2bd7dbbb1cc5
|
|
Conflict: NA
|
|
---
|
|
lib/config/config.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/lib/config/config.c b/lib/config/config.c
|
|
index 5986e64..02c757e 100644
|
|
--- a/lib/config/config.c
|
|
+++ b/lib/config/config.c
|
|
@@ -536,7 +536,7 @@ int config_file_read_fd(struct dm_config_tree *cft, struct device *dev, dev_io_r
|
|
sz = read(dev_fd(dev), buf + rsize, size - rsize);
|
|
} while ((sz < 0) && ((errno == EINTR) || (errno == EAGAIN)));
|
|
|
|
- if (sz < 0) {
|
|
+ if (sz <= 0) {
|
|
log_sys_error("read", dev_name(dev));
|
|
goto out;
|
|
}
|
|
--
|
|
2.33.0
|
|
|