So here is a small patch for a timeout...
--- setup.c 2004-03-07 22:56:34.000000000 +0100
+++ setup.c 2004-10-12 22:05:45.000000000 +0200
@@ -8,12 +8,19 @@
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
+#include <signal.h>
#include "setup.h"
#include "blockdev.h"
static int memory_unsafe = 0;
+void catch_alarm(int sig_num)
+{
+ printf("Operation timed out! Exiting\n\n");
+ exit(0);
+}
+
static int setup_enter(struct setup_backend *backend)
{
int r;
@@ -59,6 +66,9 @@
char *pass = NULL;
int buflen, i;
+ signal(SIGALRM, catch_alarm);
+ alarm(30);
+
if (isatty(fd)) {
char *pass2 = getpass(prompt); /* FIXME */
if (!pass2)
@@ -86,8 +96,11 @@
break;
}
+ alarm(0);
+
if (pass)
pass[i] = '\0';
+
return pass;
}