ref: 7ff6ea0f70307d4b82e6df69eb1310a6e27aa4ad
parent: 19cc46bc5ee1dd43537c4094d19d8da778b72bce
author: cinap_lenrek <[email protected]>
date: Sat May 2 13:05:17 EDT 2020
libdraw: fix mount() error handling in newwindow()
--- a/sys/src/libdraw/newwindow.c
+++ b/sys/src/libdraw/newwindow.c
@@ -25,8 +25,15 @@
snprint(buf, sizeof buf, "new %s", str);
else
strcpy(buf, "new");
- if(mount(fd, -1, "/mnt/wsys", MREPL, buf) < 0)
- return mount(fd, -1, "/dev", MBEFORE, buf);
- return bind("/mnt/wsys", "/dev", MBEFORE);
+ if(mount(fd, -1, "/mnt/wsys", MREPL, buf) == -1){
+ if(mount(fd, -1, "/dev", MBEFORE, buf) == -1){
+ close(fd);
+ return -1;
+ }
+ } else {
+ if(bind("/mnt/wsys", "/dev", MBEFORE) == -1)
+ return -1;
+ }
+ return 0;
}