[parted-devel] [PATCH] Properly sync partitions with operating system
Karel Zak
kzak at redhat.com
Thu Feb 26 21:03:08 UTC 2009
On Wed, Feb 25, 2009 at 11:59:33PM +0100, Joel Granados Moreno wrote:
> +static unsigned int
> +_device_get_partition_range(PedDevice* dev)
> +{
> + int range, r;
> + char path[128];
> + FILE* fp;
> + bool ok;
> +
> + r = snprintf(path, sizeof(path), "/sys/block/%s/range",
> + basename(dev->path));
always _GNU_SOURCE, right? :-)
> + if(r < 0 || r > sizeof(path))
> + return MAX_NUM_PARTS;
if(r < 0 || r >= sizeof(path))
the return value does not including the trailing '\0', see man page:
Thus, a return value of size or more means that the
output was truncated.
Karel
--
Karel Zak <kzak at redhat.com>
More information about the parted-devel
mailing list