Messages in this thread | | | From | (Miquel van Smoorenburg) | Subject | Re: Serious locking bug in Linux NFS | Date | 17 Oct 1998 22:48:43 +0200 |
| |
In article <cistron.m0zUMOE-000393C@ocean.lucon.org>, H.J. Lu <hjl@lucon.org> wrote: >> 3) I got this message while starting statd: >> >> Oct 16 13:50:15 linuxserver ./statd[23846]: address mismatch: expected >> 240.92.123.21, got 240.92.123.21 > >Here is the relevant code: > > if (lp->addr.s_addr != sin->sin_addr.s_addr) > dprintf(L_WARNING, "address mismatch: " > "expected %s, got %s\n", > inet_ntoa(lp->addr), > inet_ntoa(sin->sin_addr)); > >I don't see how it can happen besides a bad compiler/HW. It looks >like you may have a compiler/HW.
No, it's just that you cannot use inet_ntoa twice in a call to printf. inet_ntoa returns data in a static buffer. If you call it twice, the data from the first time gets overwritten.
You should do something like this:
char tmp[16];
strcpy(tmp, inet_ntoa(lp->addr)); dprintf(L_WARNING, "address mismatch: " "expected %s, got %s\n", tmp, inet_ntoa(sin->sin_addr));
Ofcourse inet_ntoa should have been designed so that it took a pointer to some storage space in which to put the result in the first place, but it's too late to change that I guess ..
Mike. -- "Did I ever tell you about the illusion of free will?" -- Sheriff Lucas Buck, ultimate BOFH.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |