Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Sep 2002 06:30:02 -0700 (PDT)
From:      Ralf Becker <ralf@akk.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   bin/42789: cp -p may report wrong exit status
Message-ID:  <200209161330.g8GDU2aj019788@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/42789; it has been noted by GNATS.

From: Ralf Becker <ralf@akk.org>
To: freebsd-gnats-submit@FreeBSD.org, slaven.rezic@berlin.de
Cc:  
Subject: bin/42789: cp -p may report wrong exit status
Date: Mon, 16 Sep 2002 15:27:25 +0200

 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 ?
 
 *** 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");
 
 Ralf
 -- 
 Ralf Becker           ralf@akk.org 
 Arbeitskreis Kultur und Kommunikation / Universitaet Karlsruhe
 Paulckeplatz 1        76131 Karlsruhe
 Tel 0721/96403-22     Fax 0721/608-4019 
 --------------------

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209161330.g8GDU2aj019788>