INN 2.4.1 urgent release
dsr+inn at mail.lns.cornell.edu
dsr+inn at mail.lns.cornell.edu
Thu Jan 8 01:11:09 UTC 2004
"Jeffrey M. Vinocur" <jeff at litech.org> writes:
> I'm getting:
>
> gcc -g -O2 -I../include -c mmap.c
> mmap.c: In function `msync_page':
> mmap.c:28: parse error before `else'
lib/mmap.c in CURRENT is pretty obviously broken:
if (pagesize == -1)
syswarn("getpagesize failed");
return -1;
else {
const size_t mask = ~(size_t)(pagesize - 1);
char *start = (char *) ((size_t) p & mask);
char *end = (char *) (((size_t) p + length + pagesize) & mask);
return msync(start, end - start, flags);
}
properly indented is
if (pagesize == -1)
syswarn("getpagesize failed");
return -1;
and what's a poor compiler to make of this with no preceding if?
else {
const size_t mask = ~(size_t)(pagesize - 1);
char *start = (char *) ((size_t) p & mask);
char *end = (char *) (((size_t) p + length + pagesize) & mask);
return msync(start, end - start, flags);
}
so there are some curlies needed. STABLE and the 2.4.1 release
candidate don't have this problem (the type of the STABLE version of
that routine is void).
Our local coding standards say to *always* put in the curlies on
for if, while, for, etc:
if (pagesize == -1)
syswarn("getpagesize failed");
doesn't meet our standards, it has to be
if (pagesize == -1) {
syswarn("getpagesize failed");
}
Some people don't like it, but our experience is that it saves trouble
later when someone decides to add to the if block.
-dan
More information about the inn-workers
mailing list