The branch, master has been updated
       via  5d7b71b7 Make use of O_NOFOLLOW if it is defined.
      from  0dde65a2 Mention more NEWS items.

https://git.samba.org/?p=rsync.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 5d7b71b7a7d76d334b104d2e5127a0d29d36d99c
Author: Wayne Davison <wa...@opencoder.net>
Date:   Thu Jun 4 19:47:59 2020 -0700

    Make use of O_NOFOLLOW if it is defined.

-----------------------------------------------------------------------

Summary of changes:
 clientserver.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)


Changeset truncated at 500 lines:

diff --git a/clientserver.c b/clientserver.c
index d56f5d52..b6067ccb 100644
--- a/clientserver.c
+++ b/clientserver.c
@@ -1157,11 +1157,17 @@ static void create_pid_file(void)
        if (!pid_file || !*pid_file)
                return;
 
+#ifdef O_NOFOLLOW
+#define SAFE_OPEN_FLAGS (O_CREAT|O_NOFOLLOW)
+#else
+#define SAFE_OPEN_FLAGS (O_CREAT)
+#endif
+
        /* These tests make sure that a temp-style lock dir is handled safely. 
*/
        st1.st_mode = 0;
        if (do_lstat(pid_file, &st1) == 0 && !S_ISREG(st1.st_mode) && 
unlink(pid_file) < 0)
                fail = "unlink";
-       else if ((pid_file_fd = do_open(pid_file, O_RDWR|O_CREAT, 0664)) < 0)
+       else if ((pid_file_fd = do_open(pid_file, O_RDWR|SAFE_OPEN_FLAGS, 
0664)) < 0)
                fail = S_ISREG(st1.st_mode) ? "open" : "create";
        else if (!lock_range(pid_file_fd, 0, 4))
                fail = "lock";


-- 
The rsync repository.

_______________________________________________
rsync-cvs mailing list
rsync-cvs@lists.samba.org
https://lists.samba.org/mailman/listinfo/rsync-cvs

Reply via email to