Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jun 2018 22:31:30 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r335181 - head/sbin/devmatch
Message-ID:  <201806142231.w5EMVUwP057078@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Thu Jun 14 22:31:30 2018
New Revision: 335181
URL: https://svnweb.freebsd.org/changeset/base/335181

Log:
  Exit with an error if a linker hints file can't be found.
  
  Continuing with a NULL hints variable just triggers a segfault later on.
  The other error cases in this function all exit for an error rather than
  warning.
  
  Reviewed by:	imp
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D15579

Modified:
  head/sbin/devmatch/devmatch.c

Modified: head/sbin/devmatch/devmatch.c
==============================================================================
--- head/sbin/devmatch/devmatch.c	Thu Jun 14 22:25:10 2018	(r335180)
+++ head/sbin/devmatch/devmatch.c	Thu Jun 14 22:31:30 2018	(r335181)
@@ -120,12 +120,8 @@ read_linker_hints(void)
 				continue;
 			break;
 		}
-		if (q == NULL) {
-			warnx("Can't read linker hints file.");
-			free(hints);
-			hints = NULL;
-			return;
-		}
+		if (q == NULL)
+			errx(1, "Can't read linker hints file.");
 	} else {
 		hints = read_hints(linker_hints, &len);
 		if (hints == NULL)



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