From 6a84782b40b888ed839512afbc0f75d97911799d Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 13 Nov 2009 13:43:58 +0100 Subject: [PATCH] linux_read: give a proper diagnostic for an "end of file" error Before today's gpt_probe bug fix, its test case would provoke an invalid diagnostic. This makes the diagnostic useful. * libparted/arch/linux.c (linux_read): When hitting EOF while reading, diagnose it properly, rather than via strerror(0) (i.e., "Success"). --- libparted/arch/linux.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c index 744f854..4fe48ec 100644 --- a/libparted/arch/linux.c +++ b/libparted/arch/linux.c @@ -1711,7 +1711,9 @@ linux_read (const PedDevice* dev, void* buffer, PedSector start, ex_status = ped_exception_throw ( PED_EXCEPTION_ERROR, PED_EXCEPTION_RETRY_IGNORE_CANCEL, - _("%s during read on %s"), + (status == 0 + ? _("end of file while reading %s") + : _("%s during read on %s")), strerror (errno), dev->path); -- 2.11.0