cvs commit: src/usr.sbin/syslogd syslogd.c

David Malone dwmalone at FreeBSD.org
Sat May 29 17:02:20 PDT 2004


dwmalone    2004/05/29 17:02:19 PDT

  FreeBSD src repository

  Modified files:
    usr.sbin/syslogd     syslogd.c 
  Log:
  Try to be more careful about using using the file descriptor f_file.
  Syslogd should ensure that f_file is a valid file descriptor when
  f_type is FILE, CONSOLE, TTY and for a PIPE where f_pid > 0. If the
  descriptor is closed/invalid then the type should be set to UNUSED
  or the pid should be set to 0.
  
  To this end:
  1) Don't close(f->f_file) if we can't send a message to a remote
     host because the file descriptor used for remote logging is
     stored in finet, not in f->f_file. f->f_file is probably
     uninitialised, so I guess we usually end up closing fd 0.
  2) Don't close PIPE file descriptors if they are invalid.
  3) If the call to p_open fails, don't set the pid.
  
  The OpenBSD patches in this area set f_file to -1 after the fd is
  closed and then avoids calling close if f_file < 0. I haven't done
  this, but it might be a good idea too.
  
  Inspired by:    PR 67139/OpenBSD
  
  Revision  Changes    Path
  1.126     +13 -7     src/usr.sbin/syslogd/syslogd.c


More information about the cvs-src mailing list