Re: Wierd knfsd behavior.

Miquel van Smoorenburg (miquels@cistron.nl)
5 Jun 1999 12:17:20 +0200


In article <cistron.199906042255.SAA11405@raven.bu.edu>,
Justin Hahn <jehahn@raven.bu.edu> wrote:
>Every now and again I get my /var/lib/nfs/{rmtab,xtab} files filled
>with lines reading:
>
>YPBINDPROC_DOMAIN: Domain not bound

Are they _in_ the /var/lib/nfs/{rmtab,xtab} files ? If so, that is a
bug in mountd, probably. The following explanation is just a guess,
I haven't looked at the source, but anyway:

The libc routines can print this error to stderr if there are NIS problems.
It can be argued that it is an error that libc prints to stderr from an
internal routine ofcourse, and I'd tend to agree, but lets not do that now :/

Anyway mountd probably closes all files on startup. Then the filedescriptor
associated with /var/lib/nfs/rmtab is filedescriptor 2. If something prints
to stderr, it will print into that file instead :(

The fix is for mountd NOT to blindly close fd 0, 1 and 2 but to do
something like this:

/* Redirect stdin/stdout/stderr */
fd = open("/dev/null", O_RDRW);
dup2(fd, 0);
dup2(fd, 1);
dup2(fd, 2);
if (fd > 2) close(fd);

Similar bugs have been fixed in other programs, such as mount(8).

Mike.

-- 
Indifference will certainly be the downfall of mankind, but who cares?

- 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/