From owner-freebsd-bugs Thu Aug 27 09:52:38 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA08822 for freebsd-bugs-outgoing; Thu, 27 Aug 1998 09:52:38 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from austin.polstra.com (austin.polstra.com [206.213.73.10]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA08809 for ; Thu, 27 Aug 1998 09:52:32 -0700 (PDT) (envelope-from jdp@austin.polstra.com) Received: from austin.polstra.com (jdp@localhost) by austin.polstra.com (8.8.8/8.8.8) with ESMTP id JAA12805; Thu, 27 Aug 1998 09:50:14 -0700 (PDT) (envelope-from jdp) Message-Id: <199808271650.JAA12805@austin.polstra.com> To: Bruce Evans cc: dmm125@bellatlantic.net, bugs@FreeBSD.ORG Subject: Re: error in libcompat (2.2.7) In-reply-to: Your message of "Thu, 27 Aug 1998 17:57:23 +1000." <199808270757.RAA07536@godzilla.zeta.org.au> Date: Thu, 27 Aug 1998 09:50:13 -0700 From: John Polstra Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > >True, that's a bug. I don't think it has any actual effect, since > >the function definition has the old pre-ANSI form: > > > > key_t > > ftok(path, id) > > const char *path; > > char id; > > > >which means that "id" is assumed to be passed as an int, even though > >only the low-order byte of it is used. But it should be fixed. > > Not a bug. The prototype must declare the arg as an int to match the > old-style-but-still-ANSI definition. The definition uses char for > historical reasons. Changing it would be incompatible. See rev.1.4 > of ftok.3 for some notes about this. I don't agree. If the prototype says it's an int, then it should be declared as int in the definition too. The definition should look like this: key_t ftok(path, id) const char *path; int id; { struct stat st; if (stat(path, &st) < 0) return (key_t)-1; return (key_t) ((char)id << 24 | (st.st_dev & 0xff) << 16 | (st.st_ino & 0xffff)); } Here, I changed the type of "id" to int, and added a (char) cast in front of its only use. John To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message