Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Mar 2017 04:04:16 +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: r315107 - head/usr.bin/diff
Message-ID:  <201703120404.v2C44GZZ033087@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Sun Mar 12 04:04:16 2017
New Revision: 315107
URL: https://svnweb.freebsd.org/changeset/base/315107

Log:
  Fix building with recent gcc
  
  Reported by:	lwhsu, ngie

Modified:
  head/usr.bin/diff/diffdir.c
  head/usr.bin/diff/diffreg.c

Modified: head/usr.bin/diff/diffdir.c
==============================================================================
--- head/usr.bin/diff/diffdir.c	Sun Mar 12 03:58:54 2017	(r315106)
+++ head/usr.bin/diff/diffdir.c	Sun Mar 12 04:04:16 2017	(r315107)
@@ -57,6 +57,8 @@ diffdir(char *p1, char *p2, int flags)
 	char path1[PATH_MAX], path2[PATH_MAX];
 	int pos;
 
+	edp1 = edp2 = NULL;
+
 	dirlen1 = strlcpy(path1, *p1 ? p1 : ".", sizeof(path1));
 	if (dirlen1 >= sizeof(path1) - 1) {
 		warnc(ENAMETOOLONG, "%s", p1);

Modified: head/usr.bin/diff/diffreg.c
==============================================================================
--- head/usr.bin/diff/diffreg.c	Sun Mar 12 03:58:54 2017	(r315106)
+++ head/usr.bin/diff/diffreg.c	Sun Mar 12 04:04:16 2017	(r315107)
@@ -200,7 +200,7 @@ static void	 range(int, int, const char 
 static void	 uni_range(int, int);
 static void	 dump_context_vec(FILE *, FILE *, int);
 static void	 dump_unified_vec(FILE *, FILE *, int);
-static void	 prepare(int, FILE *, off_t, int);
+static void	 prepare(int, FILE *, size_t, int);
 static void	 prune(void);
 static void	 equiv(struct line *, int, struct line *, int, int *);
 static void	 unravel(int);
@@ -315,6 +315,8 @@ diffreg(char *file1, char *file2, int fl
 	struct kevent *e;
 	cap_rights_t rights_ro;
 
+	e = NULL;
+	kq = -1;
 	f1 = f2 = NULL;
 	rval = D_SAME;
 	anychange = 0;
@@ -474,7 +476,7 @@ diffreg(char *file1, char *file2, int fl
 	ixnew = xreallocarray(ixnew, len[1] + 2, sizeof(*ixnew));
 	check(f1, f2, flags);
 	output(file1, f1, file2, f2, flags);
-	if (ostdout != -1) {
+	if (ostdout != -1 && e != NULL) {
 		/* close the pipe to pr and restore stdout */
 		int wstatus;
 
@@ -555,7 +557,7 @@ splice(char *dir, char *path)
 }
 
 static void
-prepare(int i, FILE *fd, off_t filesize, int flags)
+prepare(int i, FILE *fd, size_t filesize, int flags)
 {
 	struct line *p;
 	int h;



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