Path: utzoo!utgpu!watmath!clyde!att!rutgers!mailrus!ames!sgi!arisia!quintus!ok From: ok@quintus.uucp (Richard A. O'Keefe) Newsgroups: comp.lang.c Subject: Re: A lint question Message-ID: <766@quintus.UUCP> Date: 29 Nov 88 11:53:50 GMT References: <1256@vsedev.VSE.COM> Sender: news@quintus.UUCP Reply-To: ok@quintus.UUCP (Richard A. O'Keefe) Organization: Quintus Computer Systems, Inc. Lines: 26 In article <1256@vsedev.VSE.COM> logan@vsedev.VSE.COM (James Logan III) writes: >function argument ( number ) used inconsistently > malloc( arg 1 ) llib-lc(338) :: findlinks.c(114) > read( arg 3 ) llib-lc(104) :: findlinks.c(127) >I assume that lint is telling me that I am calling malloc() and >read() with an inconsistent number or parameters. Nope. Read that as "either a function argument has the wrong type, or the function has the wrong number of arguments". >extern char *malloc(); >char *directory; >directory = (char *)malloc((int)stbuf.st_size); ^^^^^^^^^^^^^^^^^ extern char *malloc(size_t howmuch); size_t is an unsigned integral type (except in BSD systems, where it's "int"). >if (read(fd, directory, (int)stbuf.st_size) != (int)stbuf.st_size) { ^^^^^^^^^^^^^^^^^^ extern int read(int fd, char *buffer, size_t howmuch); >while (read(fd, &mntbuf, sizeof(MNT)) == sizeof(MNT)) { ^^^^^^^ &mntbuf cannot be of type char* unless mntbuf is a single char. I'm assuming here that mntbuf is some sort of record; in that case you want read(fd, (char*)&mntbuf, sizeof mntbuf), not that lint will like that either.