From owner-freebsd-bugs Mon Sep 16 9: 0:14 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E8E1537B400 for ; Mon, 16 Sep 2002 09:00:11 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A4E6543E6E for ; Mon, 16 Sep 2002 09:00:11 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g8GG0BJU064700 for ; Mon, 16 Sep 2002 09:00:11 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g8GG0BjV064698; Mon, 16 Sep 2002 09:00:11 -0700 (PDT) Date: Mon, 16 Sep 2002 09:00:11 -0700 (PDT) Message-Id: <200209161600.g8GG0BjV064698@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Slaven Rezic Subject: Re: bin/42789: cp -p may report wrong exit status Reply-To: Slaven Rezic Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/42789; it has been noted by GNATS. From: Slaven Rezic To: Ralf Becker Cc: freebsd-gnats-submit@FreeBSD.org Subject: Re: bin/42789: cp -p may report wrong exit status Date: 16 Sep 2002 15:55:41 +0200 Ralf Becker writes: > In my opinion slaven's fixed the problem at the wrong place. > The error is caused by the fact that there is no check of the return > value after calling one one of the copy_* functions. > Isn't it enough to do this at the end of the loop ? The current behavior is that cp tries to copy all traversed files, regardless of an error in an individual copy. If there was at least one error, then rval is set to 1 and returned at the end of cp (except for the bug below). So you want to stop cp at the first error? What's the opinion of POSIX on this? Regards, Slaven > *** cp.c.orig Mon Sep 16 13:19:16 2002 > --- cp.c Mon Sep 16 13:26:26 2002 > *************** > *** 445,450 **** > --- 445,454 ---- > } > if (vflag && !badcp) > (void)printf("%s -> %s\n", curr->fts_path, to.p_path); > + if ( rval != 0 || badcp != 0) { > + /* error occured */ > + break; > + } > } > if (errno) > err(1, "fts_read"); > -- Slaven Rezic - slaven.rezic@berlin.de tksm - Perl/Tk program for searching and replacing in multiple files http://ptktools.sourceforge.net/#tksm To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message