]> git.ipfire.org Git - thirdparty/make.git/commitdiff
Fix bug #2846.
authorPaul Smith <psmith@gnu.org>
Tue, 25 Mar 2003 02:46:42 +0000 (02:46 +0000)
committerPaul Smith <psmith@gnu.org>
Tue, 25 Mar 2003 02:46:42 +0000 (02:46 +0000)
ChangeLog
make.h

index 146b332313c6d6b53ea526f39daeeba19d823a50..5a0e8204fccc9f57daf6e78689770bf239b1e57f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2003-03-24  Paul D. Smith  <psmith@gnu.org>
+
+       * remake.c (notice_finished_file):
+
+       * make.h (ENULLLOOP): Set errno = 0 before invoking the command;
+       some calls (like readdir()) return NULL in valid situations
+       without resetting errno.  Fixes bug #2846.
+
 2003-02-25  Paul D. Smith  <psmith@gnu.org>
 
        Port to OS/2 (__EMX__) by Andreas Buening <andreas.buening@nexgo.de>.
diff --git a/make.h b/make.h
index 5d003deff473fe6385ecd89c9e83e5131054a1d8..f7c2ad72bc1f959720321650aedc0bff27f11921 100644 (file)
--- a/make.h
+++ b/make.h
@@ -581,4 +581,13 @@ extern int handling_fatal_signal;
 
 #define EINTRLOOP(_v,_c)   while (((_v)=_c)==-1 && errno==EINTR)
 
-#define ENULLLOOP(_v,_c)   while (((_v)=_c)==0 && errno==EINTR)
+/* While system calls that return integers are pretty consistent about
+   returning -1 on failure and setting errno in that case, functions that
+   return pointers are not always so well behaved.  Sometimes they return
+   NULL for expected behavior: one good example is readdir() which returns
+   NULL at the end of the directory--and _doesn't_ reset errno.  So, we have
+   to do it ourselves here.  */
+
+#define ENULLLOOP(_v,_c)   do{ errno = 0; \
+                               while (((_v)=_c)==0 && errno==EINTR); }while(0)
+