libdraw: open internal file-descriptors with OCEXEC flag
This commit is contained in:
parent
e8b871ef5a
commit
4d22dbb0f5
5 changed files with 9 additions and 9 deletions
|
@ -22,7 +22,7 @@ _getsubfont(Display *d, char *name)
|
|||
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;
|
||||
|
|
|
@ -49,7 +49,7 @@ geninitdraw(char *devdir, void(*error)(Display*, char*), char *fontname, char *l
|
|||
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 @@ geninitdraw(char *devdir, void(*error)(Display*, char*), char *fontname, char *l
|
|||
*/
|
||||
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 @@ gengetwindow(Display *d, char *winname, Image **winp, Screen **scrp, int ref)
|
|||
|
||||
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 @@ _closedisplay(Display *disp, int isshutdown)
|
|||
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);
|
||||
|
|
|
@ -13,7 +13,7 @@ newwindow(char *str)
|
|||
wsys = getenv("wsys");
|
||||
if(wsys == nil)
|
||||
return -1;
|
||||
fd = open(wsys, ORDWR);
|
||||
fd = open(wsys, ORDWR|OCEXEC);
|
||||
if(fd < 0){
|
||||
free(wsys);
|
||||
return -1;
|
||||
|
|
|
@ -12,7 +12,7 @@ readfile(char *name)
|
|||
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;
|
||||
|
|
|
@ -16,7 +16,7 @@ writecolmap(Display *d, RGB *m)
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue