Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make Check for filemon valid.



details:   https://anonhg.NetBSD.org/src/rev/1d79f6f6d454
branches:  trunk
changeset: 1006663:1d79f6f6d454
user:      sjg <sjg%NetBSD.org@localhost>
date:      Wed Jan 22 21:04:29 2020 +0000

description:
Check for filemon valid.

If meta_needed() returns FALSE, mfp and filemon will be NULL
in which case we should not call filemon_*().

diffstat:

 usr.bin/make/meta.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (45 lines):

diff -r 73c1b8f5c206 -r 1d79f6f6d454 usr.bin/make/meta.c
--- a/usr.bin/make/meta.c       Wed Jan 22 19:22:06 2020 +0000
+++ b/usr.bin/make/meta.c       Wed Jan 22 21:04:29 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.76 2020/01/22 00:26:45 sjg Exp $ */
+/*      $NetBSD: meta.c,v 1.77 2020/01/22 21:04:29 sjg Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -124,7 +124,7 @@
 
     pbm->mon_fd = -1;
     pbm->filemon = NULL;
-    if (!useFilemon)
+    if (!useFilemon || !pbm->mfp)
        return;
 
     pbm->filemon = filemon_open();
@@ -701,7 +701,7 @@
     }
     if (pbm->mfp != NULL) {
        close(fileno(pbm->mfp));
-       if (useFilemon) {
+       if (useFilemon && pbm->filemon) {
            pid_t pid;
 
            pid = getpid();
@@ -724,7 +724,7 @@
     } else {
        pbm = &Mybm;
     }
-    if (useFilemon) {
+    if (useFilemon && pbm->filemon) {
        filemon_setpid_parent(pbm->filemon, pid);
     }
 #endif
@@ -1686,6 +1686,8 @@
     meta_job_parent(NULL, child);
     close(childPipe[1]);                       /* child side */
     outfd = childPipe[0];
+    if (!Mybm.filemon)                         /* no meta  */
+           return;
     metafd = filemon_readfd(Mybm.filemon);
 
     maxfd = -1;



Home | Main Index | Thread Index | Old Index