From owner-svn-src-all@freebsd.org Sun Dec 13 21:31:47 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D79BA43D5B; Sun, 13 Dec 2015 21:31:47 +0000 (UTC) (envelope-from ak@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3AD41DC5; Sun, 13 Dec 2015 21:31:46 +0000 (UTC) (envelope-from ak@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBDLVkPU087711; Sun, 13 Dec 2015 21:31:46 GMT (envelope-from ak@FreeBSD.org) Received: (from ak@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBDLVksx087710; Sun, 13 Dec 2015 21:31:46 GMT (envelope-from ak@FreeBSD.org) Message-Id: <201512132131.tBDLVksx087710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ak set sender to ak@FreeBSD.org using -f From: Alex Kozlov Date: Sun, 13 Dec 2015 21:31:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292172 - head/usr.bin/unzip X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 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: Sun, 13 Dec 2015 21:31:47 -0000 Author: ak (ports committer) Date: Sun Dec 13 21:31:45 2015 New Revision: 292172 URL: https://svnweb.freebsd.org/changeset/base/292172 Log: - Properly set mode and atime/ctime for symlinks Approved by: des Modified: head/usr.bin/unzip/unzip.c Modified: head/usr.bin/unzip/unzip.c ============================================================================== --- head/usr.bin/unzip/unzip.c Sun Dec 13 21:15:56 2015 (r292171) +++ head/usr.bin/unzip/unzip.c Sun Dec 13 21:31:45 2015 (r292172) @@ -127,7 +127,6 @@ errorx(const char *fmt, ...) exit(1); } -#if 0 /* non-fatal error message + errno */ static void warning(const char *fmt, ...) @@ -143,7 +142,6 @@ warning(const char *fmt, ...) va_end(ap); fprintf(stderr, ": %s\n", strerror(errno)); } -#endif /* non-fatal error message, no errno */ static void @@ -539,12 +537,21 @@ recheck: return; } + ts[0].tv_sec = 0; + ts[0].tv_nsec = UTIME_NOW; + ts[1] = mtime; + /* process symlinks */ linkname = archive_entry_symlink(e); if (linkname != NULL) { - if (symlink(linkname, *path) < 0) + if (symlink(linkname, *path) != 0) error("symlink('%s')", *path); info(" extracting: %s -> %s\n", *path, linkname); + if (lchmod(*path, mode) != 0) + warning("Cannot set mode for '%s'", *path); + /* set access and modification time */ + if (utimensat(AT_FDCWD, *path, ts, AT_SYMLINK_NOFOLLOW) != 0) + warning("utimensat('%s')", *path); return; } @@ -629,9 +636,6 @@ recheck: info("\n"); /* set access and modification time */ - ts[0].tv_sec = 0; - ts[0].tv_nsec = UTIME_NOW; - ts[1] = mtime; if (futimens(fd, ts) != 0) error("futimens('%s')", *path); if (close(fd) != 0)