[Pkg-shadow-commits] r2744 - in upstream/trunk: . src
Nicolas FRANÇOIS
nekral-guest at alioth.debian.org
Wed Apr 22 20:12:06 UTC 2009
Author: nekral-guest
Date: 2009-04-22 20:12:06 +0000 (Wed, 22 Apr 2009)
New Revision: 2744
Modified:
upstream/trunk/ChangeLog
upstream/trunk/src/login.c
Log:
* src/login.c: If we cannot get the terminal configuration, do not
change the terminal configuration. setup_tty() is just a best
effort configuration of the terminal.
* src/login.c: Ignore failures when setting the terminal
configuration.
* src/login.c: Fail if the ERASECHAR or KILLCHAR configurations
are not compatible with a cc_t type.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2009-04-22 20:07:34 UTC (rev 2743)
+++ upstream/trunk/ChangeLog 2009-04-22 20:12:06 UTC (rev 2744)
@@ -1,3 +1,13 @@
+2009-04-22 Nicolas François <nicolas.francois at centraliens.net>
+
+ * src/login.c: If we cannot get the terminal configuration, do not
+ change the terminal configuration. setup_tty() is just a best
+ effort configuration of the terminal.
+ * src/login.c: Ignore failures when setting the terminal
+ configuration.
+ * src/login.c: Fail if the ERASECHAR or KILLCHAR configurations
+ are not compatible with a cc_t type.
+
2009-04-22 Paul Szabo <psz at maths.usyd.edu.au>
* src/login.c: utent might be NULL after get_current_utmp().
Modified: upstream/trunk/src/login.c
===================================================================
--- upstream/trunk/src/login.c 2009-04-22 20:07:34 UTC (rev 2743)
+++ upstream/trunk/src/login.c 2009-04-22 20:12:06 UTC (rev 2744)
@@ -165,8 +165,10 @@
static void setup_tty (void)
{
TERMIO termio;
+ int erasechar;
+ int killchar;
- GTTY (0, &termio); /* get terminal characteristics */
+ if (GTTY (0, &termio) == 0) { /* get terminal characteristics */
/*
* Add your favorite terminal modes here ...
@@ -185,14 +187,32 @@
#endif
/* leave these values unchanged if not specified in login.defs */
- termio.c_cc[VERASE] = getdef_num ("ERASECHAR", termio.c_cc[VERASE]);
- termio.c_cc[VKILL] = getdef_num ("KILLCHAR", termio.c_cc[VKILL]);
+ erasechar = getdef_num ("ERASECHAR", (int) termio.c_cc[VERASE]);
+ killchar = getdef_num ("KILLCHAR", (int) termio.c_cc[VKILL]);
+ termio.c_cc[VERASE] = (cc_t) erasechar;
+ termio.c_cc[VKILL] = (cc_t) killchar;
+ /* Make sure the values were valid.
+ * getdef_num cannot validate this.
+ */
+ if (erasechar != termio.c_cc[VERASE]) {
+ fprintf (stderr,
+ _("configuration error - cannot parse %s value: '%d'"),
+ "ERASECHAR", erasechar);
+ exit (1);
+ }
+ if (killchar != termio.c_cc[VKILL]) {
+ fprintf (stderr,
+ _("configuration error - cannot parse %s value: '%d'"),
+ "KILLCHAR", killchar);
+ exit (1);
+ }
/*
* ttymon invocation prefers this, but these settings won't come into
* effect after the first username login
*/
- STTY (0, &termio);
+ (void) STTY (0, &termio);
+ }
}
More information about the Pkg-shadow-commits
mailing list