Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Jun 2018 21:09:25 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334896 - head/usr.bin/diff
Message-ID:  <201806092109.w59L9P9B019941@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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++;
 		}



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