[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNARfBrH2ve9J8D=iq1mdk1j-G_kOXT7CL017uqBOYPRL=Q@mail.gmail.com>
Date: Thu, 3 Nov 2016 03:30:03 +0900
From: Masahiro Yamada <yamada.masahiro@...ionext.com>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc: Jim Davis <jim.epost@...il.com>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
Michal Marek <mmarek@...e.com>,
LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: Re: scripts/basic/fixdep: Complete error handling in print_cmdline()
2016-11-03 2:38 GMT+09:00 SF Markus Elfring <elfring@...rs.sourceforge.net>:
>>>> + if (printf("cmd_%s := %s\n\n", target, cmdline) < 10) {
>>>
>>> Rather than scatter fragile magic numbers, like 10, throughout the
>>> code, if you're hell-bent on checking for printf errors you could
>>> write a little wrapper function that hid the magic number and bundled
>>> up the errno stuff.
>>
>>
>> BTW, how the magic number "10" was calculated?
>
> Does the passed format string indicate how many characters should be
> printed at least?
So, the check is a bit compromised.
The printf() should print at lease 10 characters.
If "target" or "cmdline" is not NULL, it should print more.
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists