summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSami Kerola2014-08-10 23:51:53 +0200
committerSami Kerola2014-09-19 20:31:01 +0200
commit96c4bc4dd2a35ccb8ab10b5341fa4f90ace146f4 (patch)
tree00d02436c88ab6107ab77aad93b7946fb8b5fe1f /lib
parentinclude: simplify fputc_careful() in carefulputc.h (diff)
downloadkernel-qcow2-util-linux-96c4bc4dd2a35ccb8ab10b5341fa4f90ace146f4.tar.gz
kernel-qcow2-util-linux-96c4bc4dd2a35ccb8ab10b5341fa4f90ace146f4.tar.xz
kernel-qcow2-util-linux-96c4bc4dd2a35ccb8ab10b5341fa4f90ace146f4.zip
lib: remove xgetpass()
This function is not in use, and it has reference to obsoleted getpass(). Reference: http://man7.org/linux/man-pages/man3/getpass.3.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'lib')
-rw-r--r--lib/Makemodule.am1
-rw-r--r--lib/xgetpass.c46
2 files changed, 0 insertions, 47 deletions
diff --git a/lib/Makemodule.am b/lib/Makemodule.am
index 78298691b..645090215 100644
--- a/lib/Makemodule.am
+++ b/lib/Makemodule.am
@@ -24,7 +24,6 @@ libcommon_la_SOURCES = \
lib/sysfs.c \
lib/timeutils.c \
lib/ttyutils.c \
- lib/xgetpass.c \
lib/exec_shell.c \
lib/readutmp.c
diff --git a/lib/xgetpass.c b/lib/xgetpass.c
deleted file mode 100644
index ba2089470..000000000
--- a/lib/xgetpass.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * A function to read the passphrase either from the terminal or from
- * an open file descriptor.
- *
- * Public domain.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-
-#include "c.h"
-#include "xgetpass.h"
-
-char *xgetpass(int pfd, const char *prompt)
-{
- char *pass = NULL;
- int len = 0, i;
-
- if (pfd < 0) /* terminal */
- return getpass(prompt);
-
- for (i=0; ; i++) {
- if (i >= len-1) {
- char *tmppass = pass;
- len += 128;
-
- pass = realloc(tmppass, len);
- if (!pass) {
- pass = tmppass; /* the old buffer hasn't changed */
- break;
- }
- }
- if (pass && (read(pfd, pass + i, 1) != 1 ||
- pass[i] == '\n' || pass[i] == 0))
- break;
- }
-
- if (pass)
- pass[i] = '\0';
- return pass;
-}
-