[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getpass.c



Ooops... that should have been:

> 	{
> 	  /* zap the newline; if we get an EOF instead, 
>              we zap that, too. */
> 	  l = strlen(buf);
> 	  if ((buf[l-1] != '\n') && ((int) buf[l-1] != EOF)) {
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 	    while (((c = fgetc(tty)) != '\n') && ((int) c != EOF))
> 	      /* wait for a newline or an EOF */ ;
> 	  }
> 	  if (l > PASS_MAX)
> 	    buf[PASS_MAX] = '\0';
> 	  else if ((buf[l-1] == '\n') || ((int) buf[l-1] == EOF)) 
> 	    buf[l-1] = '\0';
> 	}
>