Module Name: src
Committed By: sjg
Date: Sun Jul 9 04:54:00 UTC 2017
Modified Files:
src/usr.bin/make: meta.c
Log Message:
Ensure that command output is always followed by newline,
even when filemon is not being used.
Tweak MAKE_META_IGNORE_PATTERNS matching to avoid using path name
with :L as it does not handle ':' in path names.
fgetLine: an extra check to avoid shrinking the buffer.
To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/usr.bin/make/meta.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/meta.c
diff -u src/usr.bin/make/meta.c:1.67 src/usr.bin/make/meta.c:1.68
--- src/usr.bin/make/meta.c:1.67 Wed Aug 17 15:52:42 2016
+++ src/usr.bin/make/meta.c Sun Jul 9 04:54:00 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: meta.c,v 1.67 2016/08/17 15:52:42 sjg Exp $ */
+/* $NetBSD: meta.c,v 1.68 2017/07/09 04:54:00 sjg Exp $ */
/*
* Implement 'meta' mode.
@@ -723,7 +723,7 @@ meta_job_error(Job *job, GNode *gn, int
pbm = &Mybm;
}
if (pbm->mfp != NULL) {
- fprintf(pbm->mfp, "*** Error code %d%s\n",
+ fprintf(pbm->mfp, "\n*** Error code %d%s\n",
status,
(flags & JOB_IGNERR) ?
"(ignored)" : "");
@@ -778,13 +778,13 @@ int
meta_cmd_finish(void *pbmp)
{
int error = 0;
-#ifdef USE_FILEMON
BuildMon *pbm = pbmp;
int x;
if (!pbm)
pbm = &Mybm;
+#ifdef USE_FILEMON
if (pbm->filemon_fd >= 0) {
if (close(pbm->filemon_fd) < 0)
error = errno;
@@ -792,8 +792,9 @@ meta_cmd_finish(void *pbmp)
if (error == 0 && x != 0)
error = x;
pbm->filemon_fd = pbm->mon_fd = -1;
- }
+ } else
#endif
+ fprintf(pbm->mfp, "\n"); /* ensure end with newline */
return error;
}
@@ -857,6 +858,8 @@ fgetLine(char **bufp, size_t *szp, int o
newsz = ROUNDUP((fs.st_size / 2), BUFSIZ);
if (newsz <= bufsz)
newsz = ROUNDUP(fs.st_size, BUFSIZ);
+ if (newsz <= bufsz)
+ return x; /* truncated */
if (DEBUG(META))
fprintf(debug_file, "growing buffer %zu -> %zu\n",
bufsz, newsz);
@@ -944,10 +947,10 @@ meta_ignore(GNode *gn, const char *p)
if (metaIgnorePatterns) {
char *pm;
- snprintf(fname, sizeof(fname),
- "${%s:@m@${%s:L:M$m}@}",
- MAKE_META_IGNORE_PATTERNS, p);
- pm = Var_Subst(NULL, fname, gn, VARF_WANTRES);
+ Var_Set(".p.", p, gn, 0);
+ pm = Var_Subst(NULL,
+ "${" MAKE_META_IGNORE_PATTERNS ":@m@${.p.:M$m}@}",
+ gn, VARF_WANTRES);
if (*pm) {
#ifdef DEBUG_META_MODE
if (DEBUG(META))