]> andersk Git - openssh.git/blobdiff - openbsd-compat/readpassphrase.c
- (dtucker) [openbsd-compat/readpassphrase.c] Resync against OpenBSD's r1.18: ...
[openssh.git] / openbsd-compat / readpassphrase.c
index 4ee1be5de283d00796c7484cd3b1858ec7e7bbba..16e07e8166ce9ee50a3b32804c5a48f95b11bc9e 100644 (file)
@@ -1,6 +1,4 @@
-/* OPENBSD ORIGINAL: lib/libc/gen/readpassphrase.c */
-
-/*     $OpenBSD: readpassphrase.c,v 1.16 2003/06/17 21:56:23 millert Exp $     */
+/*     $OpenBSD: readpassphrase.c,v 1.18 2005/08/08 08:05:34 espie Exp $       */
 
 /*
  * Copyright (c) 2000-2002 Todd C. Miller <Todd.Miller@courtesan.com>
  * Materiel Command, USAF, under agreement number F39502-99-1-0512.
  */
 
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$OpenBSD: readpassphrase.c,v 1.16 2003/06/17 21:56:23 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
+/* OPENBSD ORIGINAL: lib/libc/gen/readpassphrase.c */
 
 #include "includes.h"
 
 #ifndef HAVE_READPASSPHRASE
 
 #include <termios.h>
+#include <signal.h>
+#include <ctype.h>
+#include <fcntl.h>
 #include <readpassphrase.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
 
 #ifdef TCSASOFT
 # define _T_FLUSH      (TCSAFLUSH|TCSASOFT)
@@ -137,8 +139,11 @@ restart:
                (void)write(output, "\n", 1);
 
        /* Restore old terminal settings and signals. */
-       if (memcmp(&term, &oterm, sizeof(term)) != 0)
-               (void)tcsetattr(input, _T_FLUSH, &oterm);
+       if (memcmp(&term, &oterm, sizeof(term)) != 0) {
+               while (tcsetattr(input, _T_FLUSH, &oterm) == -1 &&
+                   errno == EINTR)
+                       continue;
+       }
        (void)sigaction(SIGALRM, &savealrm, NULL);
        (void)sigaction(SIGHUP, &savehup, NULL);
        (void)sigaction(SIGINT, &saveint, NULL);
@@ -147,6 +152,7 @@ restart:
        (void)sigaction(SIGTERM, &saveterm, NULL);
        (void)sigaction(SIGTSTP, &savetstp, NULL);
        (void)sigaction(SIGTTIN, &savettin, NULL);
+       (void)sigaction(SIGTTOU, &savettou, NULL);
        if (input != STDIN_FILENO)
                (void)close(input);
 
@@ -167,7 +173,7 @@ restart:
        errno = save_errno;
        return(nr == -1 ? NULL : buf);
 }
-  
+
 #if 0
 char *
 getpass(const char *prompt)
This page took 0.082734 seconds and 4 git commands to generate.