Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com>
---
 Xtranslcl.c | 7 ++++---
 1 file 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);
-- 
2.15.2

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to