lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c15b9c71-1c37-a82d-a167-b56eace6a3b0@nvidia.com>
Date:   Thu, 3 Jun 2021 19:14:34 +0300
From:   Roi Dayan <roid@...dia.com>
To:     Stephen Hemminger <stephen@...workplumber.org>
CC:     <netdev@...r.kernel.org>, Paul Blakey <paulb@...dia.com>,
        David Ahern <dsahern@...il.com>
Subject: Re: [PATCH iproute2-next v2 1/1] police: Add support for json output



On 2021-06-03 6:49 PM, Stephen Hemminger wrote:
> On Thu, 3 Jun 2021 10:33:45 +0300
> Roi Dayan <roid@...dia.com> wrote:
> 
>>   	if (tb[TCA_POLICE_TBF] == NULL) {
>> -		fprintf(f, "[NULL police tbf]");
>> +		print_string(PRINT_FP, NULL, "%s", "[NULL police tbf]");
>>   		return 0;
>>   	}
>>   #ifndef STOOPID_8BYTE
>>   	if (RTA_PAYLOAD(tb[TCA_POLICE_TBF])  < sizeof(*p)) {
>> -		fprintf(f, "[truncated police tbf]");
>> +		print_string(PRINT_FP, NULL, "%s", "[truncated police tbf]");
> 
> These are errors, and you should just print them to stderr.
> That way if program is using JSON they can see the output on stdout;
> and look for non-structured errors on stderr.
> 

right. thanks. i'll fix it.
I think I looked in m_ct.c example for the print and there it's using
print_string(). so i'll do a commit also to fix it there.

other actions use fprintf() but they print to stdout and not stderr.
i guess those should be fixed as well.

any reason also why the original return is 0? i think it should be -1
also in that case.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ