bug-parted
[Top][All Lists]
Advanced

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

Re: GPT name overflow


From: Andrew Clausen
Subject: Re: GPT name overflow
Date: Tue, 19 Mar 2002 18:23:37 +1100
User-agent: Mutt/1.3.17i

On Mon, Mar 18, 2002 at 07:56:26PM -0700, Andreas Dilger wrote:
> > Decimal conversion of type, see below..
> 
> Well, BSD partitions only have 8 types AFAICS, so it shouldn't matter
> whether it is decimal or hex.  I could be wrong, as I've never used BSD
> partition types, but that's what I saw in the code.

fdisk uses hex *shrug*.  Everyone knows 0x83... do you know what it
is in decimal?

> > API docs also need to note that the string returned from
> > partition_get_type_name() is only valid until such time as someone calls
> > the function again.
> 
> Actually, in most cases this is not true, because we are just pointing
> to a static entry in the array.

Which makes the problem worse, because people reading the code might
get the impression that it really is constant memory.

> In general, I hate it when applications have to free memory allocated by
> a library.

Why?  Bureaucracy?  (Garbage collection rocks!  Want to rewrite parted
in haskell?!)

> I'd rather we had to pass in an array (how to know size?)
> and copy the name string into that.

I prefer the opposite, hehe.  strdup() and free() are simple.
snprintf, 2 parameters, etc. is complicated.

Also, less side-effects...

Andrew




reply via email to

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