It wasn't immediately obvious to me that the comment ("stdin is already closed, so this won't work") was actually true. I've confirmed that the other comment is true ("stdin is already closed in OsInit()"), so I believe this patch is correct. I'd like to see some explanation in the commit message, though; something like:
Since OsInit closes stdin before the xfree86 DDX opens the console, fstat on stdin will always fail, so it's safe to delete code that attempts it. I'd also like a better short description than "Remove dead code". Still: Reviewed-by: Jamey Sharp <ja...@minilop.net> On Thu, Sep 15, 2011 at 11:20:24PM +0600, Alexandr Shadchin wrote: > Signed-off-by: Alexandr Shadchin <alexandr.shadc...@gmail.com> > --- > hw/xfree86/os-support/bsd/bsd_init.c | 23 ----------------------- > 1 files changed, 0 insertions(+), 23 deletions(-) > > diff --git a/hw/xfree86/os-support/bsd/bsd_init.c > b/hw/xfree86/os-support/bsd/bsd_init.c > index 84c6b3d..1825672 100644 > --- a/hw/xfree86/os-support/bsd/bsd_init.c > +++ b/hw/xfree86/os-support/bsd/bsd_init.c > @@ -211,9 +211,6 @@ xf86OpenConsole() > "%s: No console driver found\n\tSupported drivers: %s\n\t%s", > "xf86OpenConsole", cons_drivers, CHECK_DRIVER_MSG); > } > -#if 0 /* stdin is already closed in OsInit() */ > - fclose(stdin); > -#endif > xf86Info.consoleFd = fd; > > switch (xf86Info.consType) > @@ -372,7 +369,6 @@ xf86OpenSyscons() > int fd = -1; > vtmode_t vtmode; > char vtname[12]; > - struct stat status; > long syscons_version; > MessageType from; > > @@ -425,20 +421,11 @@ xf86OpenSyscons() > { > /* > * All VTs are in use. If initialVT was found, use it. > - * Otherwise, if stdin is a VT, use that one. > - * XXX stdin is already closed, so this won't work. > */ > if (initialVT != -1) > { > xf86Info.vtno = initialVT; > } > - else if ((fstat(0, &status) >= 0) > - && S_ISCHR(status.st_mode) > - && (ioctl(0, VT_GETMODE, &vtmode) >= 0)) > - { > - /* stdin is a VT */ > - xf86Info.vtno = minor(status.st_rdev) + 1; > - } > else > { > if (syscons_version >= 0x100) > @@ -508,7 +495,6 @@ xf86OpenPcvt() > int fd = -1; > vtmode_t vtmode; > char vtname[12], *vtprefix; > - struct stat status; > struct pcvtid pcvt_version; > > #ifndef __OpenBSD__ > @@ -554,20 +540,11 @@ xf86OpenPcvt() > { > /* > * All VTs are in use. If initialVT was found, use it. > - * Otherwise, if stdin is a VT, use that one. > - * XXX stdin is already closed, so this won't work. > */ > if (initialVT != -1) > { > xf86Info.vtno = initialVT; > } > - else if ((fstat(0, &status) >= 0) > - && S_ISCHR(status.st_mode) > - && (ioctl(0, VT_GETMODE, &vtmode) >= 0)) > - { > - /* stdin is a VT */ > - xf86Info.vtno = minor(status.st_rdev) + 1; > - } > else > { > FatalError("%s: Cannot find a free VT", > -- > 1.7.6 > > _______________________________________________ > xorg-devel@lists.x.org: X.Org development > Archives: http://lists.x.org/archives/xorg-devel > Info: http://lists.x.org/mailman/listinfo/xorg-devel
signature.asc
Description: Digital signature
_______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel