diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2018-09-30 17:04:51 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2018-09-30 17:04:51 -0700 |
commit | 06cfa80fb3d03ca03fd92f9687a77958338e012c (patch) | |
tree | 8249cdac2d09dd4ecb22b78945bf211a6351079d | |
parent | 7bd504f7ab7799ab77ad50eb39f6afdbaf2f9e50 (diff) |
Use fchmod() instead of chmod() when creating named pipes
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | Xtranslcl.c | 7 |
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); |