ref: b8d5b5ebfd8b340dddd7e120a0ef9fd3675d40da
parent: ed532289b4494d50db21cb9c5e87a71585955d47
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Fri Oct 4 12:03:41 EDT 2013
page: close stdout, reopen stdout/stderr for external viewer and removed useless RFNAMEG flag we are not using stdout (fd=1) and it, so dup nullfd over it. this drops the old window reference when using with -w flag. the RFNAMEG flag isnt needed because we are calling newwindow() which forks the namespace for us. reopen stdin/stdout for the external viewer to the new window.
--- a/sys/src/cmd/page.c
+++ b/sys/src/cmd/page.c
@@ -1288,9 +1288,9 @@
fd = dup(fd, -1);
seek(fd, 0, 0);
}
- if(rfork(RFPROC|RFMEM|RFFDG|RFNOTEG|RFNAMEG|RFNOWAIT) == 0){+ if(rfork(RFPROC|RFMEM|RFFDG|RFNOTEG|RFNOWAIT) == 0){ if(newwindow(nil) != -1){- dupfds(fd, 1, 2, -1);
+ dupfds(fd, open("/dev/cons", OWRITE), open("/dev/cons", OWRITE), -1); if((fd = open("/dev/label", OWRITE)) >= 0){write(fd, label, strlen(label));
close(fd);
@@ -1520,6 +1520,7 @@
memset(&m, 0, sizeof(m));
if((nullfd = open("/dev/null", ORDWR)) < 0) sysfatal("open: %r");+ dup(nullfd, 1);
lru.lprev = &lru;
lru.lnext = &lru;
current = root = addpage(nil, "", nil, nil, -1);
--
⑨