about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--redo.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/redo.c b/redo.c
index ef130f0..a702d0d 100644
--- a/redo.c
+++ b/redo.c
@@ -627,6 +627,12 @@ run_script(char *target, int implicit)
 
 	target = targetchdir(target);
 
+	dofile = find_dofile(target);
+	if (!dofile) {
+		fprintf(stderr, "no dofile for %s.\n", target);
+		exit(1);
+	}
+
 	int lock_fd = open(targetlock(target),
 	    O_WRONLY | O_TRUNC | O_CREAT, 0666);
 	if (lockf(lock_fd, F_TLOCK, 0) < 0) {
@@ -645,12 +651,6 @@ run_script(char *target, int implicit)
 
 	target_fd = mkstemp(temp_target_base);
 
-	dofile = find_dofile(target);
-	if (!dofile) {
-		fprintf(stderr, "no dofile for %s.\n", target);
-		exit(1);
-	}
-
 	fprintf(stderr, "redo%*.*s %s # %s\n", level*2, level*2, " ", orig_target, dofile);
 	write_dep(dep_fd, dofile);