summaryrefslogtreecommitdiff
path: root/sys/src/cmd/page.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-10-04 16:03:41 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2013-10-04 16:03:41 +0200
commit8c1d4604db54021b774b17eb7440685b4638163b (patch)
treea9a23dc0027346f2d9453f74093314f9d7021607 /sys/src/cmd/page.c
parent0be917ff4d11268824d58598f85348436010f2bd (diff)
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.
Diffstat (limited to 'sys/src/cmd/page.c')
-rw-r--r--sys/src/cmd/page.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/src/cmd/page.c b/sys/src/cmd/page.c
index 1960d4cfc..7379d7a5d 100644
--- a/sys/src/cmd/page.c
+++ b/sys/src/cmd/page.c
@@ -1288,9 +1288,9 @@ showext(Page *p)
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 @@ main(int argc, char *argv[])
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);