=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ftp/util.c,v retrieving revision 1.48 retrieving revision 1.49 diff -c -r1.48 -r1.49 *** src/usr.bin/ftp/util.c 2008/05/13 02:09:38 1.48 --- src/usr.bin/ftp/util.c 2008/06/15 03:09:13 1.49 *************** *** 1,4 **** ! /* $OpenBSD: util.c,v 1.48 2008/05/13 02:09:38 ray Exp $ */ /* $NetBSD: util.c,v 1.12 1997/08/18 10:20:27 lukem Exp $ */ /*- --- 1,4 ---- ! /* $OpenBSD: util.c,v 1.49 2008/06/15 03:09:13 martynas Exp $ */ /* $NetBSD: util.c,v 1.12 1997/08/18 10:20:27 lukem Exp $ */ /*- *************** *** 71,77 **** */ #if !defined(lint) && !defined(SMALL) ! static const char rcsid[] = "$OpenBSD: util.c,v 1.48 2008/05/13 02:09:38 ray Exp $"; #endif /* not lint and not SMALL */ /* --- 71,77 ---- */ #if !defined(lint) && !defined(SMALL) ! static const char rcsid[] = "$OpenBSD: util.c,v 1.49 2008/06/15 03:09:13 martynas Exp $"; #endif /* not lint and not SMALL */ /* *************** *** 298,303 **** --- 298,305 ---- if (tmp[0] != '\0') user = tmp; } + else + exit(0); } n = command("USER %s", user); if (n == CONTINUE) { *************** *** 351,358 **** } fprintf(ttyout, "(%s) ", prompt); line[len++] = ' '; ! if (fgets(&line[len], (int)(sizeof(line) - len), stdin) == NULL) intr(); len += strlen(&line[len]); if (len > 0 && line[len - 1] == '\n') line[len - 1] = '\0'; --- 353,362 ---- } fprintf(ttyout, "(%s) ", prompt); line[len++] = ' '; ! if (fgets(&line[len], (int)(sizeof(line) - len), stdin) == NULL) { ! clearerr(stdin); intr(); + } len += strlen(&line[len]); if (len > 0 && line[len - 1] == '\n') line[len - 1] = '\0'; *************** *** 459,471 **** { char str[BUFSIZ]; if (!interactive || confirmrest) return (1); top: fprintf(ttyout, "%s %s? ", cmd, file); (void)fflush(ttyout); ! if (fgets(str, sizeof(str), stdin) == NULL) return (0); switch (tolower(*str)) { case 'n': return (0); --- 463,481 ---- { char str[BUFSIZ]; + if (confirmrest == 2) + return (0); + if (!interactive || confirmrest) return (1); top: fprintf(ttyout, "%s %s? ", cmd, file); (void)fflush(ttyout); ! if (fgets(str, sizeof(str), stdin) == NULL) { ! confirmrest = 2; ! clearerr(stdin); return (0); + } switch (tolower(*str)) { case 'n': return (0);