added a goto if fgets fails

This commit is contained in:
Todd C. Miller
1994-07-07 00:08:52 +00:00
parent 2b12703ae1
commit cd4a540c1f

View File

@@ -166,8 +166,10 @@ char * tgetpass(prompt, timeout)
}
/* get the password */
if (!fgets(buf, sizeof(buf), input))
if (!fgets(buf, sizeof(buf), input)) {
buf[0] = '\0';
goto cleanup;
}
if (*(tmp = &buf[strlen(buf)-1]) == '\n')
*tmp = '\0';