Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: printf args checks



On Tue, Aug 23, 2011 at 07:13:55PM +0200, Manuel Bouyer wrote:
> Hello,
> I get (for evbmips64-el):
> /dsk/l1/misc/bouyer/current/src/usr.bin/elf2ecoff/elf2ecoff.c: In function 
> 'safe
> write':
> /dsk/l1/misc/bouyer/current/src/usr.bin/elf2ecoff/elf2ecoff.c:576:3: error: 
> form
> at not a string literal, argument types not checked
> /dsk/l1/misc/bouyer/current/src/usr.bin/elf2ecoff/elf2ecoff.c:576:3: error: 
> form
> at not a string literal, argument types not checked

Looks like it should be this, instead, and then the safewrite()/pad16()
calls patched to remove ": %s" from the end of the 'msg' argument:

void
safewrite(int outfile, const void *buf, off_t len, const char *msg)
{
        int written;

        written = write(outfile, buf, len);
        if (written != len) {
                fprintf(stderr, "%s: %s", msg, strerror(errno));
                exit(EXIT_FAILURE
        }
}

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 344-0444 x24


Home | Main Index | Thread Index | Old Index