Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/crunch/crunchgen in dir_search(), don't assume a dir...



details:   https://anonhg.NetBSD.org/src/rev/bae1adb17f2f
branches:  trunk
changeset: 322586:bae1adb17f2f
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue May 08 23:05:17 2018 +0000

description:
in dir_search(), don't assume a directory existing is useful, instead
confirm that there is a non zero makefile in there.  (this assumes
the makefile is called "Makefile", which is assumed in other places
in crunchgen.c already, so this doesn't make it worse.)

this fixes build issues when an empty subdir exists because some files
were moved subdir at some stage (ktrace, rcorder), and a non-prune
update may look in the wrong dir.

bump version (lots of updates between now and the previous update.)

diffstat:

 usr.bin/crunch/crunchgen/crunchgen.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r 9d24300a57a2 -r bae1adb17f2f usr.bin/crunch/crunchgen/crunchgen.c
--- a/usr.bin/crunch/crunchgen/crunchgen.c      Tue May 08 22:07:02 2018 +0000
+++ b/usr.bin/crunch/crunchgen/crunchgen.c      Tue May 08 23:05:17 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: crunchgen.c,v 1.85 2017/10/08 15:06:17 christos Exp $  */
+/*     $NetBSD: crunchgen.c,v 1.86 2018/05/08 23:05:17 mrg Exp $       */
 /*
  * Copyright (c) 1994 University of Maryland
  * All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: crunchgen.c,v 1.85 2017/10/08 15:06:17 christos Exp $");
+__RCSID("$NetBSD: crunchgen.c,v 1.86 2018/05/08 23:05:17 mrg Exp $");
 #endif
 
 #include <stdlib.h>
@@ -55,7 +55,7 @@
 #include <sys/param.h>
 #include <sys/utsname.h>
 
-#define CRUNCH_VERSION "20050208"
+#define CRUNCH_VERSION "20180508"
 
 #define MAXLINELEN     16384
 #define MAXFIELDS       2048
@@ -907,8 +907,8 @@
     strlst_t *dir;
 
     for (dir=srcdirs; dir != NULL; dir=dir->next) {
-       (void)snprintf(path, sizeof(path), "%s/%s", dir->str, progname);
-       if (is_dir(path))
+       snprintf(path, sizeof(path), "%s/%s/Makefile", dir->str, progname);
+       if (is_nonempty_file(path))
            return dir->str;
     }
     return NULL;



Home | Main Index | Thread Index | Old Index