wpa_supplicant: garbled log

Denys Vlasenko vda.linux at googlemail.com
Sun Sep 29 08:02:47 EDT 2013


On Sat, Sep 28, 2013 at 11:37 AM, Jouni Malinen <j at w1.fi> wrote:
> On Sat, Sep 28, 2013 at 03:51:45AM +0200, Denys Vlasenko wrote:
>> I'm running wpa_supplicant in a way where both
>> its stdout and stderr go to the same file descriptor,
>> which isn't a tty. IOW, I do this:
>
>> Clearly, it was a perror("ioctl[SIOCSIWFREQ]"), and stdout
>> buffer happened to be not on a line boundary when perror()
>> sent its message to stderr.
>>
>> This would not be noticed if stdout and stderr are separate,
>> or if they print to a tty, since in this case they are initialized
>> to line buffered mode.
>
> stderr should not really be used, i.e., all the perror() calls should
> really be replace with something like wpa_printf(MSG_ERROR, "msg..: %s",
> strerror(errno)).

I certainly have nothing against doing this.

For the sake of good old paranoia, how about also doing

        stderr = stdout;

early in the main, so that any missed uses of stderr
would be tricked into using stdout nevertheless?

-- 
vda


More information about the HostAP mailing list