From owner-svn-src-all@FreeBSD.ORG Sat Jan 23 07:54:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DBC710657AB; Sat, 23 Jan 2010 07:54:16 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3DAE98FC13; Sat, 23 Jan 2010 07:54:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0N7sGnX041060; Sat, 23 Jan 2010 07:54:16 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0N7sGuW041058; Sat, 23 Jan 2010 07:54:16 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201001230754.o0N7sGuW041058@svn.freebsd.org> From: Tim Kientzle Date: Sat, 23 Jan 2010 07:54:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r202871 - head/lib/libarchive X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2010 07:54:16 -0000 Author: kientzle Date: Sat Jan 23 07:54:15 2010 New Revision: 202871 URL: http://svn.freebsd.org/changeset/base/202871 Log: If we can't stat a file, return the correct ARCHIVE_FAILED (this entry can't be processed any further) and a suitable error string. In particular, this improves the error-reporting when cpio -o is given a nonexistent filename. Modified: head/lib/libarchive/archive_read_disk_entry_from_file.c Modified: head/lib/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- head/lib/libarchive/archive_read_disk_entry_from_file.c Sat Jan 23 07:54:06 2010 (r202870) +++ head/lib/libarchive/archive_read_disk_entry_from_file.c Sat Jan 23 07:54:15 2010 (r202871) @@ -121,18 +121,27 @@ archive_read_disk_entry_from_file(struct */ #if HAVE_FSTAT if (fd >= 0) { - if (fstat(fd, &s) != 0) - return (ARCHIVE_FATAL); + if (fstat(fd, &s) != 0) { + archive_set_error(&a->archive, errno, + "Can't fstat"); + return (ARCHIVE_FAILED); + } } else #endif #if HAVE_LSTAT if (!a->follow_symlinks) { - if (lstat(path, &s) != 0) - return (ARCHIVE_FATAL); + if (lstat(path, &s) != 0) { + archive_set_error(&a->archive, errno, + "Can't lstat %s", path); + return (ARCHIVE_FAILED); + } } else #endif - if (stat(path, &s) != 0) - return (ARCHIVE_FATAL); + if (stat(path, &s) != 0) { + archive_set_error(&a->archive, errno, + "Can't stat %s", path); + return (ARCHIVE_FAILED); + } st = &s; } archive_entry_copy_stat(entry, st); @@ -159,7 +168,7 @@ archive_read_disk_entry_from_file(struct if (lnklen < 0) { archive_set_error(&a->archive, errno, "Couldn't read link data"); - return (ARCHIVE_WARN); + return (ARCHIVE_FAILED); } linkbuffer[lnklen] = 0; archive_entry_set_symlink(entry, linkbuffer);