Module Name: src
Committed By: riastradh
Date: Sun Apr 16 20:38:18 UTC 2017
Modified Files:
src/usr.bin/make: suff.c
Log Message:
Assert archive member syntax. Cite who guarantees it.
To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/usr.bin/make/suff.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.85 src/usr.bin/make/suff.c:1.86
--- src/usr.bin/make/suff.c:1.85 Sun Apr 16 19:53:58 2017
+++ src/usr.bin/make/suff.c Sun Apr 16 20:38:18 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.85 2017/04/16 19:53:58 riastradh Exp $ */
+/* $NetBSD: suff.c,v 1.86 2017/04/16 20:38:18 riastradh Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.85 2017/04/16 19:53:58 riastradh Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.86 2017/04/16 20:38:18 riastradh Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94";
#else
-__RCSID("$NetBSD: suff.c,v 1.85 2017/04/16 19:53:58 riastradh Exp $");
+__RCSID("$NetBSD: suff.c,v 1.86 2017/04/16 20:38:18 riastradh Exp $");
#endif
#endif /* not lint */
#endif
@@ -135,6 +135,7 @@ __RCSID("$NetBSD: suff.c,v 1.85 2017/04/
* order to find the node.
*/
+#include <assert.h>
#include <stdio.h>
#include "make.h"
#include "hash.h"
@@ -1906,6 +1907,13 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
eoarch = strchr(gn->name, '(');
eoname = strchr(eoarch, ')');
+ /*
+ * Caller guarantees the format `libname(member)', via
+ * Arch_ParseArchive.
+ */
+ assert(eoarch != NULL);
+ assert(eoname != NULL);
+
*eoname = '\0'; /* Nuke parentheses during suffix search */
*eoarch = '\0'; /* So a suffix can be found */