Re: [PATCH 03/10] nfs-utils: convert rpc.nfsd to use xlog()

Jeff Layton
2009-06-03T20:31:42Z

On Wed, 3 Jun 2009 16:22:14 -0400
Jeff Layton <jlayton@redhat.com> wrote:

> On Wed, 3 Jun 2009 16:01:24 -0400
> Chuck Lever <chuck.lever@oracle.com> wrote:
>
> > > - openlog("nfsd", LOG_PID, LOG_DAEMON);
> > > - if ((error = nfssvc(port, count, versbits, minorvers4, protobits,
> > > haddr)) < 0) {
> > > - int e = errno;
> > > - syslog(LOG_ERR, "nfssvc: %s", strerror(e));
> > > - closelog();
> > > - }
> > > + if ((error = nfssvc(port, count, versbits, minorvers4, protobits,
> > > haddr)) < 0)
> > > + xlog(L_ERROR, "nfssvc (%m)");
> >
> > Nit: Maybe get rid of the "nfssvc" here as well?
> >
>
> Well, the "nfssvc" here tells us that the nfssvc() call returned an
> error. Later patches will clean that up when I break up the nfssvc()
> interface. That said though, there's a bug there. %m isn't appropriate
> since errno isn't being set. Whoops!
>

Ahh nm. In most cases, errno will be set on error. The exception is if
the code ended up using the legacy nfsctl() call. In that case, I don't
think it gets set. Hopefully that's rare enough not to matter much.

--
Jeff Layton <jlayton@redhat.com>