[Parted-commits] GNU Parted Official Repository: Changes to 'master'

Jim Meyering meyering at alioth.debian.org
Fri Jul 6 11:50:50 UTC 2007


 libparted/arch/linux.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit b51727eb75234dc40ed21a59393883652f3fa573
Author: Michael Brennan <brennan.brisad at gmail.com>
Date:   Fri Jul 6 13:39:39 2007 +0200

    Fix a problem where a partial read would not be handled correctly;
    also change the status variable to ssize_t.

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index b921730..5ea4ac1 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -1405,7 +1405,6 @@ linux_read (const PedDevice* dev, void* buffer, PedSector start,
             PedSector count)
 {
         LinuxSpecific*          arch_specific = LINUX_SPECIFIC (dev);
-        int                     status;
         PedExceptionOption      ex_status;
         void*                   diobuf;
 
@@ -1453,10 +1452,11 @@ linux_read (const PedDevice* dev, void* buffer, PedSector start,
                 return 0;
 
         while (1) {
-                status = read (arch_specific->fd, diobuf, read_length);
+                ssize_t status = read (arch_specific->fd, diobuf, read_length);
                 if (status > 0)
                         memcpy(buffer, diobuf, status);
-                if (status == count * dev->sector_size) break;
+                if (status == (ssize_t) read_length)
+                        break;
                 if (status > 0) {
                         read_length -= status;
                         buffer = (char *) buffer + status;



More information about the Parted-commits mailing list