Subject: Re: fat16 undelete?
To: None <netbsd-users@netbsd.org>
From: Wolfgang S. Rupprecht <wolfgang+gnus20050427T045751@dailyplanet.dontspam.wsrcc.com>
List: netbsd-users
Date: 04/27/2005 05:56:13
Martin Husemann <martin@duskware.de> writes:
> On Tue, Apr 26, 2005 at 08:00:29PM -0700, Wolfgang S. Rupprecht wrote:
>> It needed a stdarg fix to make it stop segv-ing on an amd64
>
> This part I don't understand - why would it segv with the old code? Looks
> like a amd64 library bug to me, can you create a simple test that reproduces
> it and file a PR?

The old code essentially did:

    va_start(arg_list, format);
    vfprintf(stream0, format, arg_list);
    vfprintf(stream1, format, arg_list);
    va_end(arg_list);

Something within arg_list wasn't being reset correctly between the two
traversals.  Don't the specs require a va_start/va_end around each
traversal?

If the specs really don't require this, I'll file a PR, but I figured
it was just sloppy coding to assume the va_arg arg_list wasn't changed
in some way by the traversal.

>> (The second patched file was just
>> something that seemed needlessly obtuse and I was worried it was being
>> miscompiled.)
>
> Nit: the ! operator will always return 0 or 1

"will" or "should"? ;-) 

(That routine seemed to be returning the wrong cluster count, but for
a different reason.  The fat's linked list really was trashed.)

-wolfgang