From d62663423d5fc0f7bbbe439b13127ba0ff69469d Mon Sep 17 00:00:00 2001 From: kn Date: Wed, 22 Nov 2023 02:16:20 +0000 Subject: [PATCH] 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 --- usr.bin/ftp/main.c | 4 ++-- 1 file 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 -- 2.20.1