diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-10-04 15:57:05 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-10-04 15:57:05 +0200 |
commit | 0be917ff4d11268824d58598f85348436010f2bd (patch) | |
tree | d8718e842d679b25784b334ac9b8f67688a9f8b9 /sys/src/libdraw | |
parent | 40cf5957e0b59a8490b05dc65f2c3b165949f544 (diff) |
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.
Diffstat (limited to 'sys/src/libdraw')
-rw-r--r-- | sys/src/libdraw/newwindow.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/src/libdraw/newwindow.c b/sys/src/libdraw/newwindow.c index 88784adf5..7b385a322 100644 --- a/sys/src/libdraw/newwindow.c +++ b/sys/src/libdraw/newwindow.c @@ -14,14 +14,19 @@ newwindow(char *str) 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); } |