shithub: mc

Download patch

ref: 9d1c4f8aebdc89303323e33cecad42cf6aa36d7a
parent: 9b51700784b0b76155ad10591b9c224cf80cf3a6
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Sep 25 09:53:41 EDT 2014

When a directory isn't enterable, fail.

    We used to just create a child process in the same directory,
    and try again, which would load the current bldfile, which would
    try to run again, causing an infinite loop.

    Oops.

--- a/util.myr
+++ b/util.myr
@@ -17,7 +17,9 @@
 		std.fatal(1, "could not fork command\n")
 	elif pid == 0
 		if dir.len > 0
-			std.chdir(dir)
+			if std.chdir(dir) < 0
+				std.fatal(1, "unable to enter directory %s\n", dir)
+			;;
 		;;
 		if std.execvp(cmd[0], cmd) < 0
 			std.fatal(1, "failed to exec %s\n", cmd[0])