Have prompt() return NULL if EOF occurred on stdin, instead of acting
as if the user had just pressed enter. Obtained from: TrustedBSD git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@192 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
parent
82a6d21d8c
commit
e8818402d5
|
@ -31,7 +31,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $P4: //depot/projects/openpam/lib/openpam_ttyconv.c#14 $
|
||||
* $P4: //depot/projects/openpam/lib/openpam_ttyconv.c#15 $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -89,7 +89,7 @@ prompt(const char *msg)
|
|||
sigaction(SIGALRM, &saved_action, NULL);
|
||||
sigprocmask(SIG_SETMASK, &saved_sigset, NULL);
|
||||
alarm(saved_alarm);
|
||||
if (timed_out || ferror(stdin))
|
||||
if (timed_out || ferror(stdin) || feof(stdin))
|
||||
return (NULL);
|
||||
/* trim trailing whitespace */
|
||||
for (len = strlen(buf); len > 0; --len)
|
||||
|
|
Loading…
Reference in New Issue