From owner-freebsd-bugs@FreeBSD.ORG Mon Feb 4 15:20:04 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D87816A469 for ; Mon, 4 Feb 2008 15:20:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 3A47413C478 for ; Mon, 4 Feb 2008 15:20:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m14FK4I7043112 for ; Mon, 4 Feb 2008 15:20:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m14FK4k3043111; Mon, 4 Feb 2008 15:20:04 GMT (envelope-from gnats) Resent-Date: Mon, 4 Feb 2008 15:20:04 GMT Resent-Message-Id: <200802041520.m14FK4k3043111@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Spencer Minear Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B94816A418 for ; Mon, 4 Feb 2008 15:15:19 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 883F413C4E5 for ; Mon, 4 Feb 2008 15:15:19 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m14FDKgu061877 for ; Mon, 4 Feb 2008 15:13:20 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id m14FDKpI061876; Mon, 4 Feb 2008 15:13:20 GMT (envelope-from nobody) Message-Id: <200802041513.m14FDKpI061876@www.freebsd.org> Date: Mon, 4 Feb 2008 15:13:20 GMT From: Spencer Minear To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/120256: ftp -u URL/ returns a -1 exit code on success X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2008 15:20:04 -0000 >Number: 120256 >Category: misc >Synopsis: ftp -u URL/ returns a -1 exit code on success >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Feb 04 15:20:03 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Spencer Minear >Release: Found on 6.2 but still present in current >Organization: Secure Computing Corp >Environment: 6.2-RELEASE >Description: Note the results of the thee supported uses of the 'ftp -u' command. Transfer one file to a named place ftp -u ftp://minear:pby-5-cat@freebe1.slap.org/TE.db TE.db echo $? 255 Transfer one file to a directory ftp -u ftp://minear:pby-5-cat@freebe1.slap.org/ TE.db echo $? 0 Transfer two files to a direcgtory ftp -u ftp://minear:pby-5-cat@freebe1.slap.org/ TE.db foo echo $? 0 All three of these transfers completed successfully but the first is giving a bad exit code. I believe the error is at the end of the auto_put function in src/contrib/lukemftp/src/fetch.c. if (uargc == 3) { uargv[1] = argv[0]; put(uargc, uargv); goto cleanup_auto_put; } for(; argv[0] != NULL; argv++) { uargv[1] = argv[0]; mput(uargc, uargv); } rval = 0; cleanup_auto_put: FREEPTR(uargv[2]); return (rval); The first example above uses passes throught the uargc == 3 code and thus does not set the rval to 0. The other two cases use the for loop and then do set the rval to 0. The solution can be done by adding a rval = 0 following the call to put or to place the for loop in an else block and remove teh goto cleanup. I think I prefer the later solution. >How-To-Repeat: See examples in the full description. >Fix: See the recommended code change in the full description. >Release-Note: >Audit-Trail: >Unformatted: