Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make Don't core-dump when the current working direct...



details:   https://anonhg.NetBSD.org/src/rev/e6f044d71f46
branches:  trunk
changeset: 485023:e6f044d71f46
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Apr 16 23:24:04 2000 +0000

description:
Don't core-dump when the current working directory is not readable

diffstat:

 usr.bin/make/dir.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (45 lines):

diff -r 59321deb7afc -r e6f044d71f46 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Sun Apr 16 23:12:13 2000 +0000
+++ b/usr.bin/make/dir.c        Sun Apr 16 23:24:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.25 1999/11/25 22:34:16 mrg Exp $     */
+/*     $NetBSD: dir.c,v 1.26 2000/04/16 23:24:04 christos Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -39,14 +39,14 @@
  */
 
 #ifdef MAKE_BOOTSTRAP
-static char rcsid[] = "$NetBSD: dir.c,v 1.25 1999/11/25 22:34:16 mrg Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.26 2000/04/16 23:24:04 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)dir.c      8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: dir.c,v 1.25 1999/11/25 22:34:16 mrg Exp $");
+__RCSID("$NetBSD: dir.c,v 1.26 2000/04/16 23:24:04 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -95,6 +95,7 @@
  */
 
 #include <stdio.h>
+#include <errno.h>
 #include <sys/types.h>
 #include <dirent.h>
 #include <sys/stat.h>
@@ -237,6 +238,10 @@
      * do it than when we have to fetch the thing anyway?
      */
     dot = Dir_AddDir (NULL, ".");
+    if (dot == NULL) {
+       Error("Cannot open `.' (%s)", strerror(errno));
+       exit(1);
+    }
 
     /*
      * We always need to have dot around, so we increment its reference count



Home | Main Index | Thread Index | Old Index