ref: ed532289b4494d50db21cb9c5e87a71585955d47
parent: 7d7736a79d7db722d2cdeb795ad4ec10b4dd4ff6
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Fri Oct 4 11:57:05 EDT 2013
libdraw: make newwindow() unmount the old window newwindow() used to mount the new window directly on /dev, resulting in the old window and the new one being mounted over each other. we now try to unmount the old window from /dev first, mount new window to /mnt/wsys (replacing the old) and then bind /mnt/wsys before /dev. if theres no /mnt/wsys, just mount window directly before /dev.
--- a/sys/src/libdraw/newwindow.c
+++ b/sys/src/libdraw/newwindow.c
@@ -14,14 +14,19 @@
if(wsys == nil)
return -1;
fd = open(wsys, ORDWR);
- free(wsys);
- if(fd < 0)
+ if(fd < 0){+ free(wsys);
return -1;
+ }
rfork(RFNAMEG);
+ unmount(wsys, "/dev"); /* drop reference to old window */
+ free(wsys);
if(str)
snprint(buf, sizeof buf, "new %s", str);
else
strcpy(buf, "new");
- return mount(fd, -1, "/dev", MBEFORE, buf);
+ if(mount(fd, -1, "/mnt/wsys", MREPL, buf) < 0)
+ return mount(fd, -1, "/dev", MBEFORE, buf);
+ return bind("/mnt/wsys", "/dev", MBEFORE);}
--
⑨