bsd: Remove dead code
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. Signed-off-by: Alexandr Shadchin <Alexandr.Shadchin@gmail.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Tested-by: Matthieu Herrb <matthieu.herrb@laas.fr>
This commit is contained in:
		
							parent
							
								
									cbb842666f
								
							
						
					
					
						commit
						dc864770d4
					
				| 
						 | 
					@ -210,9 +210,6 @@ xf86OpenConsole()
 | 
				
			||||||
		"%s: No console driver found\n\tSupported drivers: %s\n\t%s",
 | 
							"%s: No console driver found\n\tSupported drivers: %s\n\t%s",
 | 
				
			||||||
		"xf86OpenConsole", cons_drivers, CHECK_DRIVER_MSG);
 | 
							"xf86OpenConsole", cons_drivers, CHECK_DRIVER_MSG);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#if 0 /* stdin is already closed in OsInit() */
 | 
					 | 
				
			||||||
	fclose(stdin);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
	xf86Info.consoleFd = fd;
 | 
						xf86Info.consoleFd = fd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (xf86Info.consType)
 | 
						switch (xf86Info.consType)
 | 
				
			||||||
| 
						 | 
					@ -372,7 +369,6 @@ xf86OpenSyscons()
 | 
				
			||||||
    int fd = -1;
 | 
					    int fd = -1;
 | 
				
			||||||
    vtmode_t vtmode;
 | 
					    vtmode_t vtmode;
 | 
				
			||||||
    char vtname[12];
 | 
					    char vtname[12];
 | 
				
			||||||
    struct stat status;
 | 
					 | 
				
			||||||
    long syscons_version;
 | 
					    long syscons_version;
 | 
				
			||||||
    MessageType from;
 | 
					    MessageType from;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -425,20 +421,11 @@ xf86OpenSyscons()
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		    /*
 | 
							    /*
 | 
				
			||||||
		     * All VTs are in use.  If initialVT was found, use it.
 | 
							     * 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)
 | 
							    if (initialVT != -1)
 | 
				
			||||||
		    {
 | 
							    {
 | 
				
			||||||
			xf86Info.vtno = initialVT;
 | 
								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
 | 
							    else
 | 
				
			||||||
		    {
 | 
							    {
 | 
				
			||||||
			if (syscons_version >= 0x100)
 | 
								if (syscons_version >= 0x100)
 | 
				
			||||||
| 
						 | 
					@ -508,7 +495,6 @@ xf86OpenPcvt()
 | 
				
			||||||
    int fd = -1;
 | 
					    int fd = -1;
 | 
				
			||||||
    vtmode_t vtmode;
 | 
					    vtmode_t vtmode;
 | 
				
			||||||
    char vtname[12], *vtprefix;
 | 
					    char vtname[12], *vtprefix;
 | 
				
			||||||
    struct stat status;
 | 
					 | 
				
			||||||
    struct pcvtid pcvt_version;
 | 
					    struct pcvtid pcvt_version;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __OpenBSD__
 | 
					#ifndef __OpenBSD__
 | 
				
			||||||
| 
						 | 
					@ -554,20 +540,11 @@ xf86OpenPcvt()
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		    /*
 | 
							    /*
 | 
				
			||||||
		     * All VTs are in use.  If initialVT was found, use it.
 | 
							     * 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)
 | 
							    if (initialVT != -1)
 | 
				
			||||||
		    {
 | 
							    {
 | 
				
			||||||
			xf86Info.vtno = initialVT;
 | 
								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
 | 
							    else
 | 
				
			||||||
		    {
 | 
							    {
 | 
				
			||||||
			FatalError("%s: Cannot find a free VT",
 | 
								FatalError("%s: Cannot find a free VT",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue