chiark / gitweb /
mount: only add those mount points to localfs.target as Wants that are marked for us
[elogind.git] / util.c
diff --git a/util.c b/util.c
index e32e2f2566399e131e5dd5cd5dea965a70f16602..17ee09c1f7d23da9782c3db0b4432f505c7579d0 100644 (file)
--- a/util.c
+++ b/util.c
@@ -658,7 +658,6 @@ char *strstrip(char *s) {
                 *s = 0;
 
         return s;
-
 }
 
 char *delete_chars(char *s, const char *bad) {
@@ -1423,14 +1422,18 @@ int reset_terminal(int fd) {
 
         assert(fd >= 0);
 
-        /* Set terminal up for job control */
+        /* Set terminal to some sane defaults */
 
         if (tcgetattr(fd, &termios) < 0) {
                 r = -errno;
                 goto finish;
         }
 
-        termios.c_iflag &= ~(IGNBRK | BRKINT);
+        /* We only reset the stuff that matters to the software. How
+         * hardware is set up we don't touch assuming that somebody
+         * else will do that for us */
+
+        termios.c_iflag &= ~(IGNBRK | BRKINT | ISTRIP | INLCR | IGNCR | IUCLC);
         termios.c_iflag |= ICRNL | IMAXBEL | IUTF8;
         termios.c_oflag |= ONLCR;
         termios.c_cflag |= CREAD;
@@ -1447,6 +1450,8 @@ int reset_terminal(int fd) {
         termios.c_cc[VLNEXT]   =  026;  /* ^V */
         termios.c_cc[VWERASE]  =  027;  /* ^W */
         termios.c_cc[VREPRINT] =  022;  /* ^R */
+        termios.c_cc[VEOL]     =    0;
+        termios.c_cc[VEOL2]    =    0;
 
         termios.c_cc[VTIME]  = 0;
         termios.c_cc[VMIN]   = 1;
@@ -1637,6 +1642,16 @@ int release_terminal(void) {
         return r;
 }
 
+int ignore_signal(int sig) {
+        struct sigaction sa;
+
+        zero(sa);
+        sa.sa_handler = SIG_IGN;
+        sa.sa_flags = SA_RESTART;
+
+        return sigaction(sig, &sa, NULL);
+}
+
 static const char *const ioprio_class_table[] = {
         [IOPRIO_CLASS_NONE] = "none",
         [IOPRIO_CLASS_RT] = "realtime",