diff options
author | Lewis Russell <lewis6991@gmail.com> | 2023-01-31 11:47:02 +0000 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2023-02-01 11:14:20 +0000 |
commit | b3d304df93347ef3f585ae91ae9ff6f5f28651af (patch) | |
tree | 1512649a15be5d7bd3ae6a97e38c348bfd6e333d | |
parent | c1a3865c476844e1b30200e2e7f3f9f2fa682329 (diff) | |
download | rneovim-b3d304df93347ef3f585ae91ae9ff6f5f28651af.tar.gz rneovim-b3d304df93347ef3f585ae91ae9ff6f5f28651af.tar.bz2 rneovim-b3d304df93347ef3f585ae91ae9ff6f5f28651af.zip |
refactor(fileio.c): remove HAVE_ACL ifdefs
-rw-r--r-- | src/nvim/fileio.c | 18 | ||||
-rw-r--r-- | src/nvim/os/fs.c | 2 | ||||
-rw-r--r-- | src/nvim/undo.c | 2 |
3 files changed, 1 insertions, 21 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 4b3a52759d..77b8cc833f 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -2628,9 +2628,7 @@ static int buf_write_make_backup(char *fname, bool append, FileInfo *file_info_o (double)file_info_old->stat.st_atim.tv_sec, (double)file_info_old->stat.st_mtim.tv_sec); #endif -#ifdef HAVE_ACL os_set_acl(*backupp, acl); -#endif *err = set_err(NULL); break; } @@ -2908,12 +2906,10 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en goto fail; } -#ifdef HAVE_ACL // For systems that support ACL: get the ACL from the original file. if (!newfile) { acl = os_get_acl(fname); } -#endif // If 'backupskip' is not empty, don't make a backup for some files. bool dobackup = (p_wb || p_bk || *p_pm != NUL); @@ -3371,13 +3367,11 @@ restore_backup: if (perm >= 0) { // Set perm. of new file same as old file. (void)os_setperm((const char *)wfname, (int)perm); } -#ifdef HAVE_ACL // Probably need to set the ACL before changing the user (can't set the // ACL on a file the user doesn't own). if (!backup_copy) { os_set_acl(wfname, acl); } -#endif if (wfname != fname) { // The file was written to a temp file, now it needs to be converted @@ -3588,9 +3582,7 @@ nofail: iconv_close(write_info.bw_iconv_fd); write_info.bw_iconv_fd = (iconv_t)-1; } -#ifdef HAVE_ACL os_free_acl(acl); -#endif if (err.msg != NULL) { // - 100 to save some space for further error message @@ -4577,15 +4569,11 @@ int vim_rename(const char *from, const char *to) // Rename() failed, try copying the file. long perm = os_getperm(from); -#ifdef HAVE_ACL // For systems that support ACL: get the ACL from the original file. vim_acl_T acl = os_get_acl(from); -#endif int fd_in = os_open((char *)from, O_RDONLY, 0); if (fd_in < 0) { -#ifdef HAVE_ACL os_free_acl(acl); -#endif return -1; } @@ -4593,9 +4581,7 @@ int vim_rename(const char *from, const char *to) int fd_out = os_open((char *)to, O_CREAT|O_EXCL|O_WRONLY|O_NOFOLLOW, (int)perm); if (fd_out < 0) { close(fd_in); -#ifdef HAVE_ACL os_free_acl(acl); -#endif return -1; } @@ -4605,9 +4591,7 @@ int vim_rename(const char *from, const char *to) if (buffer == NULL) { close(fd_out); close(fd_in); -#ifdef HAVE_ACL os_free_acl(acl); -#endif return -1; } @@ -4631,10 +4615,8 @@ int vim_rename(const char *from, const char *to) #ifndef UNIX // For Unix os_open() already set the permission. os_setperm(to, perm); #endif -#ifdef HAVE_ACL os_set_acl(to, acl); os_free_acl(acl); -#endif if (errmsg != NULL) { semsg(errmsg, to); return -1; diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index 302faa8140..8915b0de3e 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -788,6 +788,7 @@ int os_setperm(const char *const name, int perm) # ifdef HAVE_SYS_ACCESS_H # include <sys/access.h> # endif +#endif // Return a pointer to the ACL of file "fname" in allocated memory. // Return NULL if the ACL is not available for whatever reason. @@ -811,7 +812,6 @@ void os_free_acl(vim_acl_T aclent) return; } } -#endif #ifdef UNIX /// Checks if the current user owns a file. diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 0f12c00f15..2b5dd297b5 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -1339,14 +1339,12 @@ write_error: semsg(_("E829: write error in undo file: %s"), file_name); } -#ifdef HAVE_ACL if (buf->b_ffname != NULL) { // For systems that support ACL: get the ACL from the original file. vim_acl_T acl = os_get_acl(buf->b_ffname); os_set_acl(file_name, acl); os_free_acl(acl); } -#endif theend: if (file_name != name) { |