[PATCH] Fix bug #9166 - Starting smbd or nmbd with stdin from /dev/null results in "EOF on stdin"

Andrew Bartlett abartlet at samba.org
Wed Jun 19 11:24:24 MDT 2013

On Wed, 2013-06-19 at 09:23 -0700, Jeremy Allison wrote:
> On Wed, Jun 19, 2013 at 01:52:43PM +1000, Andrew Bartlett wrote:
> > On Tue, 2013-06-18 at 11:18 -0700, Jeremy Allison wrote:
> > > OEM confirms this fixes the issue for them.
> > > 
> > > Please review and push if you're ok with it.
> > 
> > The source4/smbd/server.c patch seems to be missing an fstat call.
> Ok I'll add that. Was fixing nmbd/winbindd/smbd initially.
> > Also, what happens if the fd is not a file, but a socket or a pipe?
> That's what the patch does - when it's a socket or pipe
> the stdin handler is added, not otherwise.

What made me ask that is that I wondered: does fstat() work for all
possible inputs here?  I could imagine that for those, it could fail due
to them not being file system FDs (eg from pipe()).

I'm guessing it works (at least on Linux), as otherwise make test should
fail spectacularly, but that's what prompted the query.  I note our
'is_a_socket()' function operates quite differently, instead trying a
socket call. 

Andrew Bartlett

Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org

More information about the samba-technical mailing list