Dr. Werner Fink 2011-05-19 10:55:24 +00:00 committed by Git OBS Bridge
parent 83457e257d
commit 1a09f0dba6
2 changed files with 36 additions and 31 deletions

View File

@ -1,7 +1,5 @@
Index: src/sulogin.c
===================================================================
--- src/sulogin.c (revision 98)
+++ src/sulogin.c (working copy)
--- src/sulogin.c
+++ src/sulogin.c 2011-05-19 10:47:11.783926103 +0000
@@ -28,8 +28,10 @@
*
*/
@ -732,7 +730,7 @@ Index: src/sulogin.c
/*
* See if we have a timeout flag.
@@ -510,115 +874,128 @@ int main(int argc, char **argv)
@@ -510,115 +874,138 @@ int main(int argc, char **argv)
}
if (geteuid() != 0) {
@ -761,7 +759,14 @@ Index: src/sulogin.c
- fprintf(stderr, "%s: not a tty\n", tty);
- close(fd);
- } else {
-
+ /*
+ * See if we need to open an other tty device.
+ */
+ if (optind < argc)
+ tty = argv[optind];
+ if (!tty || *tty == '\0')
+ tty = getenv("CONSOLE");
- /*
- * Only go through this trouble if the new
- * tty doesn't fall in this process group.
@ -777,7 +782,11 @@ Index: src/sulogin.c
- setpgid(0, getpgid(getppid()));
- setsid();
- }
-
+ /*
+ * Detect possible consoles, use stdin as fallback.
+ */
+ detect_consoles(tty, 0);
- signal(SIGHUP, SIG_IGN);
- if (ttypgrp > 0)
- ioctl(0, TIOCNOTTY, (char *)1);
@ -807,23 +816,20 @@ Index: src/sulogin.c
- setsid();
- if (ioctl(0, TIOCSCTTY, (char *)1))
- perror("ioctl(TIOCSCTTY)");
- }
+ /*
+ * See if we need to open an other tty device.
+ * Should not happen
+ */
+ if (optind < argc)
+ tty = argv[optind];
+ if (!tty || *tty == '\0')
+ tty = getenv("CONSOLE");
+ if (!consoles) {
+ if (!errno)
+ errno = ENOMEM;
+ fprintf(stderr, "sulogin: cannot open console: %m\n\r");
+ exit(1);
}
-#if defined(SANE_TIO) && (SANE_TIO == 1)
- fixtty();
-#endif
+ /*
+ * Detect possible consoles, use stdin as fallback.
+ */
+ detect_consoles(tty, 0);
-
/*
* Get the root password.
*/
@ -949,10 +955,8 @@ Index: src/sulogin.c
- */
return 0;
}
Index: src/consoles.c
===================================================================
--- src/consoles.c (revision 100)
+++ src/consoles.c (working copy)
--- src/consoles.c
+++ src/consoles.c 2011-04-01 10:37:59.827926346 +0000
@@ -27,9 +27,21 @@
#include <string.h>
#include <sys/types.h>
@ -1396,10 +1400,8 @@ Index: src/consoles.c
+ consoles->fd = fallback;
}
}
Index: src/consoles.h
===================================================================
--- src/consoles.h (revision 100)
+++ src/consoles.h (working copy)
--- src/consoles.h
+++ src/consoles.h 2011-04-01 09:25:53.402826920 +0000
@@ -21,13 +21,28 @@
* Author: Werner Fink <werner@suse.de>
*/
@ -1433,10 +1435,8 @@ Index: src/consoles.h
extern struct console *consoles;
-extern void detect_consoles(void);
+extern void detect_consoles(const char *, int);
Index: src/Makefile
===================================================================
--- src/Makefile (revision 100)
+++ src/Makefile (working copy)
--- src/Makefile
+++ src/Makefile 2010-03-23 15:11:12.000000000 +0000
@@ -112,7 +112,7 @@ utmpdump: utmpdump.o
runlevel: runlevel.o

View File

@ -1,3 +1,8 @@
------------------------------------------------------------------
Thu May 19 12:53:51 CEST 2011 - werner@suse.de
- Add latest change for sulogin multiple console devices support
------------------------------------------------------------------
Wed Apr 20 13:14:43 CEST 2011 - werner@suse.de
@ -34,7 +39,7 @@ Wed Apr 6 15:22:20 CEST 2011 - werner@suse.de
------------------------------------------------------------------
Fri Apr 1 15:00:19 CEST 2011 - werner@suse.de
- Let sulogin respect device on the comman line as well as the
- Let sulogin respect device on the command line as well as the
standard input
- Let sulogin initialize serial terminals