bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in linux_check (linux.c) ?


From: K . G .
Subject: Bug in linux_check (linux.c) ?
Date: Thu, 9 Sep 2004 01:51:31 +0200

done is of type 'int' while count is 'PedSector'
I think that will loop until the end of the device on very large hard drive and
with count >= 1<<31
I havn't written a patch because I'm not sure how 'read' works on large files
but I guess s/int done = 0;/PedSector done = 0;/ would be enough ?


---
static PedSector
linux_check (PedDevice* dev, void* buffer, PedSector start, PedSector count)
{
        LinuxSpecific*  arch_specific = LINUX_SPECIFIC (dev);
        int             done = 0;
        int             status;

        if (!_device_seek (dev, start))
                return 0;

        for (done = 0; done < count; done += status / PED_SECTOR_SIZE) {
                status = read (arch_specific->fd, buffer,
                               (count-done) * PED_SECTOR_SIZE);
                if (status < 0)
                        break;
        }

        return done;
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]