From owner-svn-src-all@freebsd.org Sat Jun 9 21:09:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF9131001372; Sat, 9 Jun 2018 21:09:25 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 613E376423; Sat, 9 Jun 2018 21:09:25 +0000 (UTC) (envelope-from bapt@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43BA423218; Sat, 9 Jun 2018 21:09:25 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w59L9PXw019942; Sat, 9 Jun 2018 21:09:25 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w59L9P9B019941; Sat, 9 Jun 2018 21:09:25 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201806092109.w59L9P9B019941@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 9 Jun 2018 21:09:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334896 - head/usr.bin/diff X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: head/usr.bin/diff X-SVN-Commit-Revision: 334896 X-SVN-Commit-Repository: base 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.26 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, 09 Jun 2018 21:09:25 -0000 Author: bapt Date: Sat Jun 9 21:09:24 2018 New Revision: 334896 URL: https://svnweb.freebsd.org/changeset/base/334896 Log: diff: Import fixes from OpenBSD original commit log by miller@OpenBSD r1.46: Fix exit value when diffing directories with missing files and the -N or -P options are not used. From Ibrahim Khalifa Modified: head/usr.bin/diff/diffdir.c Modified: head/usr.bin/diff/diffdir.c ============================================================================== --- head/usr.bin/diff/diffdir.c Sat Jun 9 21:05:25 2018 (r334895) +++ head/usr.bin/diff/diffdir.c Sat Jun 9 21:09:24 2018 (r334896) @@ -58,7 +58,7 @@ diffdir(char *p1, char *p2, int flags) dirlen1 = strlcpy(path1, *p1 ? p1 : ".", sizeof(path1)); if (dirlen1 >= sizeof(path1) - 1) { warnc(ENAMETOOLONG, "%s", p1); - status = 2; + status |= 2; return; } if (path1[dirlen1 - 1] != '/') { @@ -68,7 +68,7 @@ diffdir(char *p1, char *p2, int flags) dirlen2 = strlcpy(path2, *p2 ? p2 : ".", sizeof(path2)); if (dirlen2 >= sizeof(path2) - 1) { warnc(ENAMETOOLONG, "%s", p2); - status = 2; + status |= 2; return; } if (path2[dirlen2 - 1] != '/') { @@ -131,12 +131,12 @@ diffdir(char *p1, char *p2, int flags) dp2++; } else if (pos < 0) { /* file only in first dir, only diff if -N */ - if (Nflag) + if (Nflag) { diffit(dent1, path1, dirlen1, path2, dirlen2, flags); - else { + } else { print_only(path1, dirlen1, dent1->d_name); - status = 1; + status |= 1; } dp1++; } else { @@ -146,7 +146,7 @@ diffdir(char *p1, char *p2, int flags) flags); else { print_only(path2, dirlen2, dent2->d_name); - status = 1; + status |= 1; } dp2++; }