shithub: riscv

Download patch

ref: dac5756766be04f303bceaea49eba4f6ffc4e25e
parent: a07a2025dab770421992362d8f4e4acbbf776fa8
author: cinap_lenrek <[email protected]>
date: Tue Aug 9 22:40:16 EDT 2016

ratrace: fix fork/exec race with "nohang" procctl (like a debugger)

--- a/sys/src/cmd/ratrace.c
+++ b/sys/src/cmd/ratrace.c
@@ -192,6 +192,7 @@
 		if (pid < 0)
 			sysfatal("fork failed: %r");
 		if(pid == 0) {
+			write(open(smprint("/proc/%d/ctl", getpid()), OWRITE|OCEXEC), "hang", 4);
 			exec(cmd, args);
 			if(cmd[0] != '/')
 				exec(smprint("/bin/%s", cmd), args);