[PATCH 4/6] added openconnect_strdup()

Nikos Mavrogiannopoulos nmav at gnutls.org
Tue Sep 16 05:12:02 PDT 2014

On Mon, Sep 15, 2014 at 2:25 PM, David Woodhouse <dwmw2 at infradead.org> wrote:
> On Tue, 2014-08-26 at 16:00 +0200, Nikos Mavrogiannopoulos wrote:
>> +             ret = -GetLastError();
> Hm, that makes us return a value that isn't in the normal errno space,
> doesn't it?
> Admittedly, I don't think anyone ever actually *does* anything with the
> return value from script_config_tun(), but still I think we should use
> FormatMessage() to print the error correctly, and then return something
> like -EIO rather than a Windows error code.

I thought it didn't make much sense to bother as there was no check of
this function's error code, but strictly speaking you're right.

>> -     if (ret == 0x2331) {
>> -             /* This is what cmd.exe returns for unrecognised commands */
> That made some sense...
>>       if (ret) {
>> +             /* This is what cmd.exe returns for unrecognised commands */
> ... but this doesn't. For a start we're not using cmd.exe any more...
> and you seem to be suggesting that *all* values other than -1 mean that
> it was an unrecognised command :)

Indeed. Do you want an updated patch?


More information about the openconnect-devel mailing list