bug-wget
[Top][All Lists]
Advanced

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

Re: [Bug-wget] [PATCH v2] wget: Add --use-askpass support


From: Liam R. Howlett
Subject: Re: [Bug-wget] [PATCH v2] wget: Add --use-askpass support
Date: Thu, 28 Jul 2016 15:36:11 -0400
User-agent: Mutt/1.5.23 (2014-03-12)

* ?ngel Gonz?lez <address@hidden> [160727 18:36]:
> On 27/07/16 16:15, Liam R. Howlett wrote:
> >>There are a few spots that require C99 (char * const argv, unsigned int
> >>bytes), but I'm unsure if we ending up dropping C90 support or not.
> >I'd be happy to do this - however I need help doing so.  The issue is
> >that changing char * question to a const causes compile issues with the
> >char * const argv[] discarding the const qualifier.  argv must be of
> >this type for the call to posix_spawn.  The only way I've found to be
> >C99 and avoid compile issues is to pass char **question, but then it's
> >being passed in so that it can be edited only to avoid complaints on
> >compile and for C99 which seems less than ideal.
> 
> I was just pointing out the location: the variable argv, the variable bytes?
> I don't expect the conversion from char* to char * const to be problematic.
> The problem was intermixing code with a variable declaration.
> 
> So, for instance on:
> + close(com[1]);
> + unsigned int bytes = read(com[0], tmp, sizeof(tmp));
> 
> you are defining bytes after calling close()
> 
> so it would need to be something like:
> 
> +    unsigned int bytes;
> +    close(com[1]);
> +    bytes = read(com[0], tmp, sizeof(tmp));
> 
> 
> And now that I see it, in case read() returns -1 due to an error, it would
> convert to MAX_INT, then attempt to strndup() such huge value and crash. It
> should be a ssize_t

Ah yes.  Thank you.  I did notice this too.  I've moved the declaration
to the top of the function and changed it to ssize_t.  Error condition
will be checked for this condition.

I appreciate the clarification and the attention to detail surrounding
my enquiry.  I'll send out V3 soon with this and the other issues
addressed.

V3 will also change --use-askpass to a flag as you have requested.
Passing in an empty string will result in WGET_ASKPASS and then
SSH_ASKPASS to be used (if set).

Thanks,
Liam



> 
> Regards
> 
> 
> And no



reply via email to

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