summaryrefslogtreecommitdiff
path: root/Xtranslcl.c
diff options
context:
space:
mode:
Diffstat (limited to 'Xtranslcl.c')
-rw-r--r--Xtranslcl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Xtranslcl.c b/Xtranslcl.c
index 9eddf37..26b7f63 100644
--- a/Xtranslcl.c
+++ b/Xtranslcl.c
@@ -773,11 +773,12 @@ TRANS(NAMEDOpenPipe)(const char *server_path)
prmsg(1, "NAMEDOpenPipe: Can't open %s\n", server_path);
return(-1);
}
- close(fd);
- if (chmod(server_path, (mode_t)0666) < 0) {
- prmsg(1, "NAMEDOpenPipe: Can't open %s\n", server_path);
+ if (fchmod(fd, (mode_t)0666) < 0) {
+ prmsg(1, "NAMEDOpenPipe: Can't chmod %s\n", server_path);
+ close(fd);
return(-1);
}
+ close(fd);
} else {
prmsg(1, "NAMEDOpenPipe: stat on %s failed\n", server_path);
return(-1);