diff --git a/grub-core/osdep/unix/password.c b/grub-core/osdep/unix/password.c index 470a6ea62..4b9507bce 100644 --- a/grub-core/osdep/unix/password.c +++ b/grub-core/osdep/unix/password.c @@ -53,7 +53,10 @@ grub_password_get (char buf[], unsigned buf_size) tty_changed = 0; grub_memset (buf, 0, buf_size); if (!fgets (buf, buf_size, stdin)) - return 0; + { + fclose (in); + return 0; + } ptr = buf + strlen (buf) - 1; while (buf <= ptr && (*ptr == '\n' || *ptr == '\r')) *ptr-- = 0; @@ -64,5 +67,7 @@ grub_password_get (char buf[], unsigned buf_size) grub_xputs ("\n"); grub_refresh (); + fclose (in); + return 1; }