readpassphrase.c (215236) | readpassphrase.c (241046) |
---|---|
1/* $OpenBSD: readpassphrase.c,v 1.23 2010/05/14 13:30:34 millert Exp $ */ 2 3/* 4 * Copyright (c) 2000-2002, 2007, 2010 5 * Todd C. Miller <Todd.Miller@courtesan.com> 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above --- 8 unchanged lines hidden (view full) --- 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 * 19 * Sponsored in part by the Defense Advanced Research Projects 20 * Agency (DARPA) and Air Force Research Laboratory, Air Force 21 * Materiel Command, USAF, under agreement number F39502-99-1-0512. 22 */ 23 24#include <sys/cdefs.h> | 1/* $OpenBSD: readpassphrase.c,v 1.23 2010/05/14 13:30:34 millert Exp $ */ 2 3/* 4 * Copyright (c) 2000-2002, 2007, 2010 5 * Todd C. Miller <Todd.Miller@courtesan.com> 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above --- 8 unchanged lines hidden (view full) --- 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 * 19 * Sponsored in part by the Defense Advanced Research Projects 20 * Agency (DARPA) and Air Force Research Laboratory, Air Force 21 * Materiel Command, USAF, under agreement number F39502-99-1-0512. 22 */ 23 24#include <sys/cdefs.h> |
25__FBSDID("$FreeBSD: head/lib/libc/gen/readpassphrase.c 215236 2010-11-13 10:38:06Z delphij $"); | 25__FBSDID("$FreeBSD: head/lib/libc/gen/readpassphrase.c 241046 2012-09-29 11:54:34Z jilles $"); |
26 27#include "namespace.h" 28#include <ctype.h> 29#include <errno.h> 30#include <fcntl.h> 31#include <paths.h> 32#include <pwd.h> 33#include <signal.h> --- 29 unchanged lines hidden (view full) --- 63 nr = -1; 64 save_errno = 0; 65 need_restart = 0; 66 /* 67 * Read and write to /dev/tty if available. If not, read from 68 * stdin and write to stderr unless a tty is required. 69 */ 70 if ((flags & RPP_STDIN) || | 26 27#include "namespace.h" 28#include <ctype.h> 29#include <errno.h> 30#include <fcntl.h> 31#include <paths.h> 32#include <pwd.h> 33#include <signal.h> --- 29 unchanged lines hidden (view full) --- 63 nr = -1; 64 save_errno = 0; 65 need_restart = 0; 66 /* 67 * Read and write to /dev/tty if available. If not, read from 68 * stdin and write to stderr unless a tty is required. 69 */ 70 if ((flags & RPP_STDIN) || |
71 (input = output = _open(_PATH_TTY, O_RDWR)) == -1) { | 71 (input = output = _open(_PATH_TTY, O_RDWR | O_CLOEXEC)) == -1) { |
72 if (flags & RPP_REQUIRE_TTY) { 73 errno = ENOTTY; 74 return(NULL); 75 } 76 input = STDIN_FILENO; 77 output = STDERR_FILENO; 78 } 79 --- 115 unchanged lines hidden --- | 72 if (flags & RPP_REQUIRE_TTY) { 73 errno = ENOTTY; 74 return(NULL); 75 } 76 input = STDIN_FILENO; 77 output = STDERR_FILENO; 78 } 79 --- 115 unchanged lines hidden --- |