fix possible close of unrelated fd on error path

- infd var is uninitialised on error path in case where
  maxlen is less than 1
This commit is contained in:
Ondrej Kozina
2014-09-29 18:18:29 +02:00
committed by Milan Broz
parent ce30d5f1fd
commit 3cffadb508

View File

@@ -179,7 +179,7 @@ static int interactive_pass(const char *prompt, char *pass, size_t maxlen,
int infd, outfd; int infd, outfd;
if (maxlen < 1) if (maxlen < 1)
goto out_err; return failed;
/* Read and write to /dev/tty if available */ /* Read and write to /dev/tty if available */
infd = open("/dev/tty", O_RDWR); infd = open("/dev/tty", O_RDWR);