ref: 4d22dbb0f5a0cd4d3202a01a8cc18b632b5c9b01
parent: e8b871ef5af74187a17b068e8fc2c1b44384a782
author: cinap_lenrek <[email protected]>
date: Mon Dec 7 09:32:34 EST 2020
libdraw: open internal file-descriptors with OCEXEC flag
--- a/sys/src/libdraw/getsubfont.c
+++ b/sys/src/libdraw/getsubfont.c
@@ -22,7 +22,7 @@
if(dolock)
unlockdisplay(d);
- fd = open(name, OREAD);
+ fd = open(name, OREAD|OCEXEC);
if(fd < 0) {
fprint(2, "getsubfont: can't open %s: %r\n", name);
f = nil;
--- a/sys/src/libdraw/init.c
+++ b/sys/src/libdraw/init.c
@@ -49,7 +49,7 @@
return -1;
}
if(fontname == nil){
- fd = open("/env/font", OREAD);
+ fd = open("/env/font", OREAD|OCEXEC);
if(fd >= 0){
n = read(fd, buf, sizeof(buf));
if(n>0 && n<sizeof buf-1){
@@ -82,11 +82,11 @@
*/
if(label != nil){
snprint(buf, sizeof buf, "%s/label", display->windir);
- fd = open(buf, OREAD);
+ fd = open(buf, OREAD|OCEXEC);
if(fd >= 0){
read(fd, display->oldlabel, (sizeof display->oldlabel)-1);
close(fd);
- fd = create(buf, OWRITE, 0666);
+ fd = create(buf, OWRITE|OCEXEC, 0666);
if(fd >= 0){
write(fd, label, strlen(label));
close(fd);
@@ -125,7 +125,7 @@
obuf[0] = 0;
retry:
- fd = open(winname, OREAD);
+ fd = open(winname, OREAD|OCEXEC);
if(fd<0 || (n=read(fd, buf, sizeof buf-1))<=0){
if(fd >= 0) close(fd);
strcpy(buf, "noborder");
@@ -345,7 +345,7 @@
display = nil;
if(disp->oldlabel[0]){
snprint(buf, sizeof buf, "%s/label", disp->windir);
- fd = open(buf, OWRITE);
+ fd = open(buf, OWRITE|OCEXEC);
if(fd >= 0){
write(fd, disp->oldlabel, strlen(disp->oldlabel));
close(fd);
--- a/sys/src/libdraw/newwindow.c
+++ b/sys/src/libdraw/newwindow.c
@@ -13,7 +13,7 @@
wsys = getenv("wsys");
if(wsys == nil)
return -1;
- fd = open(wsys, ORDWR);
+ fd = open(wsys, ORDWR|OCEXEC);
if(fd < 0){
free(wsys);
return -1;
--- a/sys/src/libdraw/openfont.c
+++ b/sys/src/libdraw/openfont.c
@@ -12,7 +12,7 @@
n = 0;
r = -1;
if((s = malloc(HUNK)) != nil){
- if((f = open(name, OREAD)) >= 0){
+ if((f = open(name, OREAD|OCEXEC)) >= 0){
while((r = read(f, s+n, HUNK)) > 0){
n += r;
r = -1;
--- a/sys/src/libdraw/writecolmap.c
+++ b/sys/src/libdraw/writecolmap.c
@@ -16,7 +16,7 @@
ulong r, g, b;
sprint(buf, "/dev/draw/%d/colormap", d->dirno);
- fd = open(buf, OWRITE);
+ fd = open(buf, OWRITE|OCEXEC);
if(fd < 0)
drawerror(d, "writecolmap: open colormap failed");
t = malloc(8192);