summaryrefslogtreecommitdiff
path: root/remake.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2005-06-25 23:00:17 +0000
committerPaul Smith <psmith@gnu.org>2005-06-25 23:00:17 +0000
commitf388233b033ccae26e567fb573fd3d7a87c71744 (patch)
tree1c51defb3a7e907880bb538ce9fd19bf6333d7d2 /remake.c
parent6cdaff0948bbec3220d5cb071f79d5f2e1c9b083 (diff)
downloadgunmake-f388233b033ccae26e567fb573fd3d7a87c71744.tar.gz
Fix Savannah bug # 13478. If -L is given, take the latest mtime for a
symlink even if it is "dangling" (it doesn't resolve to a real file).
Diffstat (limited to 'remake.c')
-rw-r--r--remake.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/remake.c b/remake.c
index 5f82f03..750a80c 100644
--- a/remake.c
+++ b/remake.c
@@ -1328,13 +1328,18 @@ name_mtime (char *name)
int e;
EINTRLOOP (e, stat (name, &st));
- if (e != 0)
+ if (e == 0)
+ mtime = FILE_TIMESTAMP_STAT_MODTIME (name, st);
+ else if (errno == ENOENT || errno == ENOTDIR)
+ mtime = NONEXISTENT_MTIME;
+ else
{
- if (errno != ENOENT && errno != ENOTDIR)
- perror_with_name ("stat: ", name);
+ perror_with_name ("stat: ", name);
return NONEXISTENT_MTIME;
}
- mtime = FILE_TIMESTAMP_STAT_MODTIME (name, st);
+
+ /* If we get here we either found it, or it doesn't exist.
+ If it doesn't exist see if we can use a symlink mtime instead. */
#ifdef MAKE_SYMLINKS
#ifndef S_ISLNK
@@ -1361,8 +1366,9 @@ name_mtime (char *name)
EINTRLOOP (e, lstat (lpath, &st));
if (e)
{
- /* Eh? Just take what we have. */
- perror_with_name ("lstat: ", lpath);
+ /* Just take what we have so far. */
+ if (errno != ENOENT && errno != ENOTDIR)
+ perror_with_name ("lstat: ", lpath);
break;
}