[patch iwhd 2/3] do not leak "pending"

Jim Meyering jim at meyering.net
Fri Jul 8 05:45:56 UTC 2011


Pete Zaitcev wrote:
> On Thu, 07 Jul 2011 15:27:39 +0200
> Jim Meyering <jim at meyering.net> wrote:
>
>> >  		error (0, errno, _("pipe creation failed"));
>> > +		sprintf(ami_id_buf,"failed (pipe)");
>>
>> Please use strcpy in cases like this where there is no
>> sprintf formatting directive:
>>
>>     		strcpy(ami_id_buf,"failed (pipe)");
>
> I'm curious why you prefer that. Optimization?

A few reasons:
  - static analyzers tend to warn about sprintf use
  - sn?printf use without a formatting directive makes me think
      maybe there was one initially (to require all that machinery),
      but it was removed.  I know that's not the case here, but still.
  - do not surprise the reviewer ;-) http://www.osnews.com/story/19266/WTFs_m
  - when a simple tool can do the job just as well, why use a much
      larger, more powerful one?


More information about the iwhd-devel mailing list