summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2023-11-22 02:16:21 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2023-11-22 02:16:21 +0000
commitfd74e2a4a4d53268c3f4f710270d051542aeaf8f (patch)
tree6ea960cbe564e6eba6aaa1ba702bdc7edf4cd81f
parent996ad718e8cd39d414989a2bb7d97761e63cc57e (diff)
Do not drop into "ftp> " shell when piping to stdandard output
'-o -' is orthogonal to an interactive prompt, yet some (malformed) URLs such as ftp://host/ would still end up there; exit after processing the first file/URL to prevent this. sthen deraadt agree OK millert
-rw-r--r--usr.bin/ftp/main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c
index 2d6265bd128..2a62fbaa896 100644
--- a/usr.bin/ftp/main.c
+++ b/usr.bin/ftp/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.139 2023/11/09 18:18:59 kn Exp $ */
+/* $OpenBSD: main.c,v 1.140 2023/11/22 02:16:20 kn Exp $ */
/* $NetBSD: main.c,v 1.24 1997/08/18 10:20:26 lukem Exp $ */
/*
@@ -640,7 +640,7 @@ main(volatile int argc, char *argv[])
}
rval = auto_fetch(argc, argv, outfile);
- if (rval >= 0) /* -1 == connected and cd-ed */
+ if (rval >= 0 || pipeout) /* -1 == connected and cd-ed */
exit(rval);
} else {
#ifndef SMALL