ref: d649586e750604585369429b82963dbed434307d
parent: e29aea8358355e6e195ec2782ec0d7b67eac4f1c
author: james palmer <[email protected]>
date: Mon Jun 7 16:04:37 EDT 2021
fix awinclose
--- a/window.c
+++ b/window.c
@@ -40,7 +40,7 @@
char buf[12];
w = mallocz(sizeof(AWin), 1);
- w->ctlfd = open("/mnt/wsys/new/ctl", ORDWR|OCEXEC);
+ w->ctlfd = open("/mnt/wsys/new/ctl", ORDWR);
if(w->ctlfd < 0)
sysfatal("open ctl: %r");
if(read(w->ctlfd, buf, sizeof(buf)) != sizeof(buf))
@@ -47,8 +47,8 @@
sysfatal("read ctl: %r");
w->id = atoi(buf);
- w->addrfd = awinfsopen(w, "addr", ORDWR);
- w->datafd = awinfsopen(w, "data", ORDWR);
+ w->addrfd = -1;
+ w->datafd = -1;
w->next = awins;
awins = w;
@@ -110,8 +110,14 @@
void
awinclear(AWin *w)
{
+ w->addrfd = awinfsopen(w, "addr", OWRITE);
+ w->datafd = awinfsopen(w, "data", OWRITE);
+
fprint(w->addrfd, ",");
- fprint(w->datafd, "");
+ write(w->datafd, "", 0);
+
+ close(w->datafd);
+ close(w->addrfd);
}
int