diff options
author | Martynas Venckus <martynas@cvs.openbsd.org> | 2008-06-16 12:03:52 +0000 |
---|---|---|
committer | Martynas Venckus <martynas@cvs.openbsd.org> | 2008-06-16 12:03:52 +0000 |
commit | 8b142a22a8eed8285a5e1fad1725670d3dc598d7 (patch) | |
tree | 39f08b7594b536239ea8bd48e53783f66071e19f /usr.bin/ftp/util.c | |
parent | 7912ce36fe14d6938f590a26869879d50aaa995c (diff) |
fix transfer interrupting when confirmrest mode is used. change
confirm() to have a 'force' argument, so that ointer/oconf dance
is not needed, and to prevent further bugs like this; ok millert@
Diffstat (limited to 'usr.bin/ftp/util.c')
-rw-r--r-- | usr.bin/ftp/util.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/usr.bin/ftp/util.c b/usr.bin/ftp/util.c index 99776bd2b02..9b87f504dfd 100644 --- a/usr.bin/ftp/util.c +++ b/usr.bin/ftp/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.49 2008/06/15 03:09:13 martynas Exp $ */ +/* $OpenBSD: util.c,v 1.50 2008/06/16 12:03:51 martynas Exp $ */ /* $NetBSD: util.c,v 1.12 1997/08/18 10:20:27 lukem Exp $ */ /*- @@ -71,7 +71,7 @@ */ #if !defined(lint) && !defined(SMALL) -static const char rcsid[] = "$OpenBSD: util.c,v 1.49 2008/06/15 03:09:13 martynas Exp $"; +static const char rcsid[] = "$OpenBSD: util.c,v 1.50 2008/06/16 12:03:51 martynas Exp $"; #endif /* not lint and not SMALL */ /* @@ -459,20 +459,25 @@ remglob(char *argv[], int doswitch, char **errbuf) } int -confirm(const char *cmd, const char *file) +confirm(const char *cmd, const char *file, int force) { char str[BUFSIZ]; - if (confirmrest == 2) + + if (force) + goto top; + + if (confirmrest == -1) return (0); - if (!interactive || confirmrest) + if (confirmrest || !interactive) return (1); top: fprintf(ttyout, "%s %s? ", cmd, file); (void)fflush(ttyout); if (fgets(str, sizeof(str), stdin) == NULL) { - confirmrest = 2; + if (!force) + confirmrest = -1; clearerr(stdin); return (0); } |