@@ -17,6 +17,7 @@
#include <string.h>
#include <unistd.h>
#include <stdarg.h>
+#include <stdbool.h>
#include "bltin.h"
#include "../exec.h"
@@ -471,16 +472,17 @@ newerf (const char *f1, const char *f2)
{
struct stat64 b1, b2;
+ if(stat64(f1, &b1) != 0)
+ return false;
+ if(stat64(f2, &b2) != 0)
+ return true;
+
#ifdef HAVE_ST_MTIM
- return (stat64(f1, &b1) == 0 &&
- stat64(f2, &b2) == 0 &&
+ return
( b1.st_mtim.tv_sec > b2.st_mtim.tv_sec ||
- (b1.st_mtim.tv_sec == b2.st_mtim.tv_sec && (b1.st_mtim.tv_nsec > b2.st_mtim.tv_nsec )))
- );
+ (b1.st_mtim.tv_sec == b2.st_mtim.tv_sec && (b1.st_mtim.tv_nsec > b2.st_mtim.tv_nsec )));
#else
- return (stat64(f1, &b1) == 0 &&
- stat64(f2, &b2) == 0 &&
- b1.st_mtime > b2.st_mtime);
+ return b1.st_mtime > b2.st_mtime;
#endif
}
@@ -489,16 +491,17 @@ olderf (const char *f1, const char *f2)
{
struct stat64 b1, b2;
+ if(stat64(f2, &b2) != 0)
+ return false;
+ if(stat64(f1, &b1) != 0)
+ return true;
+
#ifdef HAVE_ST_MTIM
- return (stat64(f1, &b1) == 0 &&
- stat64(f2, &b2) == 0 &&
+ return
(b1.st_mtim.tv_sec < b2.st_mtim.tv_sec ||
- (b1.st_mtim.tv_sec == b2.st_mtim.tv_sec && (b1.st_mtim.tv_nsec < b2.st_mtim.tv_nsec )))
- );
+ (b1.st_mtim.tv_sec == b2.st_mtim.tv_sec && (b1.st_mtim.tv_nsec < b2.st_mtim.tv_nsec )));
#else
- return (stat64(f1, &b1) == 0 &&
- stat64(f2, &b2) == 0 &&
- b1.st_mtime < b2.st_mtime);
+ return b1.st_mtime < b2.st_mtime;
#endif
}
@@ -2019,7 +2019,12 @@ .Ss Builtins
exist and
.Ar file1
is newer than
-.Ar file2 .
+.Ar file2 ,
+or if
+.Ar file1
+exists but
+.Ar file2
+doesn't.
.It Ar file1 Fl ot Ar file2
True if
.Ar file1
@@ -2028,7 +2033,12 @@ .Ss Builtins
exist and
.Ar file1
is older than
-.Ar file2 .
+.Ar file2 ,
+or if
+.Ar file2
+exists but
+.Ar file1
+doesn't.
.It Ar file1 Fl ef Ar file2
True if
.Ar file1