[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in GNU Parted
From: |
Wouter Coene |
Subject: |
Re: Bug in GNU Parted |
Date: |
Sun, 13 May 2001 01:45:00 +0200 |
According to Andrew Clausen (address@hidden):
[snip]
> > I've submitted this patch before, but it was refused claiming this
> > condition couldn't happen if parted was programmed according to the API
> > specification.
>
> Exactly. I want to find out why Parted "isn't programmed
> according to the API".
Well, the code itself strikes me as rather odd, too. In version 1.4.9 (not
the latest version, but I don't believe that part of the code has changed
much lately, plus I don't have access to any newer versions right now),
ped_device_close() (libparted/device.c:812) calls _do_refresh_close()
(libparted/device.c:738) while decrementing dev->open_count. However, the
contents of _do_refresh_close() is a mere:
static int
_do_refresh_close (PedDevice* dev)
{
return 1;
}
I encountered this problem in a program I worked on some time ago too, but
my patch (which is still in the version of parted I use to build said
program) solved that nicely.
I think it has something to do with dev->open_count being only incremented
on the opening of the device by the disk layer, and that somehow right after
the parted command-line editor is started, unlike the device layer, the disk
layer remains uninitialized until a command is executed.
This would also mean that, since ped_disk_close() closes the device (and
thus decrements dev->open_count), there must be a small memory leak in the
parted command line editor at program termination, caused by
ped_disk_close() not being called for every opened disk "object", otherwise
this problem would have been noticed earlier.
Wouter
ps: sorry about my previous post (which was rather rude I believe). I think
I'll blame the weather (hot and humid) for that one.
--
* Wouter Coene * C/PHP/TCL * address@hidden *
*** I do not speak for my employer until I say I do ***
** "First they ignore you. Then they laugh at you. **
** Then they fight you. Then you win." -- Gandhi **