about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2015-09-01 16:47:29 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2015-09-01 16:47:29 +0200
commit4de1ce83e1d45bb3206770895dc84b26aaf76f18 (patch)
treef6ae800130c770b281bd3bc85ad2c3a3906a1e08
parent58c2bd8df65d3704b2a6cdde0bf347d58036685f (diff)
downloadredo-c-4de1ce83e1d45bb3206770895dc84b26aaf76f18.tar.gz
redo-c-4de1ce83e1d45bb3206770895dc84b26aaf76f18.tar.xz
redo-c-4de1ce83e1d45bb3206770895dc84b26aaf76f18.zip
Skip over nonexisting files in record_deps
-rw-r--r--redo.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/redo.c b/redo.c
index 08dbbb4..5dc8064 100644
--- a/redo.c
+++ b/redo.c
@@ -700,14 +700,18 @@ static void
 record_deps(int targetc, char *targetv[])
 {
 	int targeti = 0;
+	int fd;
 
 	dep_fd = envfd("REDO_DEP_FD");
+	if (dep_fd < 0)
+		return;
 
 	for (targeti = 0; targeti < targetc; targeti++) {
-		int fd = open(targetv[targeti], O_RDONLY);
-		char *hash = hashfile(fd);
+		fd = open(targetv[targeti], O_RDONLY);
+		if (fd < 0)
+			continue;
 		// here, we write out the unmodified target name!
-		dprintf(dep_fd, "=%s!%s\n", hash, targetv[targeti]);
+		dprintf(dep_fd, "=%s!%s\n", hashfile(fd), targetv[targeti]);
 		close(fd);
 	}
 }