Here is a patch (diff -urNp) against the whole 1.8.0rc2 trunk directory. It includes the previous patch against parted/parted.c which I had sent. So if that is not applied, you only need to apply this one.
It mainly deals with the following new points: 1. libparted/arch/linux.c -->> a. readFD does not need to allocate 16384 bytes (= 16KB) initially to read /proc/devices. It is merely an ASCII file, which lists the major device numbers of all the devices. It is highly imporabable (if not impossible) for it to be larger than 2KB. The extra memory requirement might lead to a 'memory allocation error/failure' in memory-starved systems. Hence I have shortenend it to 1024 bytes (=1KB). b. It is better to set filesize to zero during initialization. Would be faster that way. c. We can combine the error and EOF encountered by 'read' conditions. d. Before finishing off the excess memory needs to be realeased, and it would be good idea to set the byte following the last character to NULL. e. Calloc becomes uneccessary now. Moreover, realloc does not initialize the locations to zero, so it does not make any difference as compared to malloc. 2. libparted/arch/linux.c -->> a. _is_dm_major can be trimmed a bit. 3. libparted/device.c -->> a. canonicalize_file_name does a calloc, which should use sizeof(char) instead of 1. I am cc'ing this to Leslie and David, since the list might block the attached patch. Hope it will be useful. Happy hacking, Debarshi -- "India is not, as people keep calling it, an underdeveloped country, but rather a developed nation in an advanced state of decay." --Shashi Tharoor
patch
Description: Binary data
_______________________________________________ parted-devel mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/parted-devel

