mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
Remove O_EXTRA which was only for EMX and cygwin.
This commit is contained in:
parent
bf9aeda01c
commit
b951cf5bfc
@ -1656,12 +1656,12 @@ void write_viminfo(char_u *file, int forceit)
|
|||||||
# ifdef UNIX
|
# ifdef UNIX
|
||||||
umask_save = umask(0);
|
umask_save = umask(0);
|
||||||
fd = mch_open((char *)tempname,
|
fd = mch_open((char *)tempname,
|
||||||
O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW,
|
O_CREAT|O_EXCL|O_WRONLY|O_NOFOLLOW,
|
||||||
(int)((st_old.st_mode & 0777) | 0600));
|
(int)((st_old.st_mode & 0777) | 0600));
|
||||||
(void)umask(umask_save);
|
(void)umask(umask_save);
|
||||||
# else
|
# else
|
||||||
fd = mch_open((char *)tempname,
|
fd = mch_open((char *)tempname,
|
||||||
O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW, 0600);
|
O_CREAT|O_EXCL|O_WRONLY|O_NOFOLLOW, 0600);
|
||||||
# endif
|
# endif
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
fp_out = NULL;
|
fp_out = NULL;
|
||||||
|
26
src/fileio.c
26
src/fileio.c
@ -478,13 +478,13 @@ readfile (
|
|||||||
if (!read_buffer && !read_stdin) {
|
if (!read_buffer && !read_stdin) {
|
||||||
if (!newfile || readonlymode) {
|
if (!newfile || readonlymode) {
|
||||||
file_readonly = TRUE;
|
file_readonly = TRUE;
|
||||||
} else if ((fd = mch_open((char *)fname, O_RDWR | O_EXTRA, 0)) < 0) {
|
} else if ((fd = mch_open((char *)fname, O_RDWR, 0)) < 0) {
|
||||||
// opening in readwrite mode failed => file is readonly
|
// opening in readwrite mode failed => file is readonly
|
||||||
file_readonly = TRUE;
|
file_readonly = TRUE;
|
||||||
}
|
}
|
||||||
if (file_readonly == TRUE) {
|
if (file_readonly == TRUE) {
|
||||||
// try to open readonly
|
// try to open readonly
|
||||||
fd = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0);
|
fd = mch_open((char *)fname, O_RDONLY, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -668,7 +668,7 @@ readfile (
|
|||||||
|| (using_b_ffname && (old_b_ffname != curbuf->b_ffname))
|
|| (using_b_ffname && (old_b_ffname != curbuf->b_ffname))
|
||||||
|| (using_b_fname && (old_b_fname != curbuf->b_fname))
|
|| (using_b_fname && (old_b_fname != curbuf->b_fname))
|
||||||
|| (fd =
|
|| (fd =
|
||||||
mch_open((char *)fname, O_RDONLY | O_EXTRA,
|
mch_open((char *)fname, O_RDONLY,
|
||||||
0)) < 0)) {
|
0)) < 0)) {
|
||||||
--no_wait_return;
|
--no_wait_return;
|
||||||
msg_scroll = msg_save;
|
msg_scroll = msg_save;
|
||||||
@ -2178,7 +2178,7 @@ readfile_charconvert (
|
|||||||
fname, tmpname) == FAIL)
|
fname, tmpname) == FAIL)
|
||||||
errmsg = (char_u *)_("Conversion with 'charconvert' failed");
|
errmsg = (char_u *)_("Conversion with 'charconvert' failed");
|
||||||
if (errmsg == NULL && (*fdp = mch_open((char *)tmpname,
|
if (errmsg == NULL && (*fdp = mch_open((char *)tmpname,
|
||||||
O_RDONLY | O_EXTRA, 0)) < 0)
|
O_RDONLY, 0)) < 0)
|
||||||
errmsg = (char_u *)_("can't read output of 'charconvert'");
|
errmsg = (char_u *)_("can't read output of 'charconvert'");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2195,7 +2195,7 @@ readfile_charconvert (
|
|||||||
|
|
||||||
/* If the input file is closed, open it (caller should check for error). */
|
/* If the input file is closed, open it (caller should check for error). */
|
||||||
if (*fdp < 0)
|
if (*fdp < 0)
|
||||||
*fdp = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0);
|
*fdp = mch_open((char *)fname, O_RDONLY, 0);
|
||||||
|
|
||||||
return tmpname;
|
return tmpname;
|
||||||
}
|
}
|
||||||
@ -2991,7 +2991,7 @@ buf_write (
|
|||||||
backup_ext = p_bex;
|
backup_ext = p_bex;
|
||||||
|
|
||||||
if (backup_copy
|
if (backup_copy
|
||||||
&& (fd = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0)) >= 0) {
|
&& (fd = mch_open((char *)fname, O_RDONLY, 0)) >= 0) {
|
||||||
int bfd;
|
int bfd;
|
||||||
char_u *copybuf, *wp;
|
char_u *copybuf, *wp;
|
||||||
int some_error = FALSE;
|
int some_error = FALSE;
|
||||||
@ -3130,7 +3130,7 @@ buf_write (
|
|||||||
/* Open with O_EXCL to avoid the file being created while
|
/* Open with O_EXCL to avoid the file being created while
|
||||||
* we were sleeping (symlink hacker attack?) */
|
* we were sleeping (symlink hacker attack?) */
|
||||||
bfd = mch_open((char *)backup,
|
bfd = mch_open((char *)backup,
|
||||||
O_WRONLY|O_CREAT|O_EXTRA|O_EXCL|O_NOFOLLOW,
|
O_WRONLY|O_CREAT|O_EXCL|O_NOFOLLOW,
|
||||||
perm & 0777);
|
perm & 0777);
|
||||||
if (bfd < 0) {
|
if (bfd < 0) {
|
||||||
vim_free(backup);
|
vim_free(backup);
|
||||||
@ -3436,7 +3436,7 @@ nobackup:
|
|||||||
* (this may happen when the user reached his quotum for number of files).
|
* (this may happen when the user reached his quotum for number of files).
|
||||||
* Appending will fail if the file does not exist and forceit is FALSE.
|
* Appending will fail if the file does not exist and forceit is FALSE.
|
||||||
*/
|
*/
|
||||||
while ((fd = mch_open((char *)wfname, O_WRONLY | O_EXTRA | (append
|
while ((fd = mch_open((char *)wfname, O_WRONLY | (append
|
||||||
? (forceit ? (
|
? (forceit ? (
|
||||||
O_APPEND |
|
O_APPEND |
|
||||||
O_CREAT) :
|
O_CREAT) :
|
||||||
@ -3781,9 +3781,9 @@ restore_backup:
|
|||||||
MSG(_(e_interr));
|
MSG(_(e_interr));
|
||||||
out_flush();
|
out_flush();
|
||||||
}
|
}
|
||||||
if ((fd = mch_open((char *)backup, O_RDONLY | O_EXTRA, 0)) >= 0) {
|
if ((fd = mch_open((char *)backup, O_RDONLY, 0)) >= 0) {
|
||||||
if ((write_info.bw_fd = mch_open((char *)fname,
|
if ((write_info.bw_fd = mch_open((char *)fname,
|
||||||
O_WRONLY | O_CREAT | O_TRUNC | O_EXTRA,
|
O_WRONLY | O_CREAT | O_TRUNC,
|
||||||
perm & 0777)) >= 0) {
|
perm & 0777)) >= 0) {
|
||||||
/* copy the file. */
|
/* copy the file. */
|
||||||
write_info.bw_buf = smallbuf;
|
write_info.bw_buf = smallbuf;
|
||||||
@ -3926,7 +3926,7 @@ restore_backup:
|
|||||||
|
|
||||||
if (org == NULL
|
if (org == NULL
|
||||||
|| (empty_fd = mch_open(org,
|
|| (empty_fd = mch_open(org,
|
||||||
O_CREAT | O_EXTRA | O_EXCL | O_NOFOLLOW,
|
O_CREAT | O_EXCL | O_NOFOLLOW,
|
||||||
perm < 0 ? 0666 : (perm & 0777))) < 0)
|
perm < 0 ? 0666 : (perm & 0777))) < 0)
|
||||||
EMSG(_("E206: patchmode: can't touch empty original file"));
|
EMSG(_("E206: patchmode: can't touch empty original file"));
|
||||||
else
|
else
|
||||||
@ -5034,7 +5034,7 @@ int vim_rename(char_u *from, char_u *to)
|
|||||||
/* For systems that support ACL: get the ACL from the original file. */
|
/* For systems that support ACL: get the ACL from the original file. */
|
||||||
acl = mch_get_acl(from);
|
acl = mch_get_acl(from);
|
||||||
#endif
|
#endif
|
||||||
fd_in = mch_open((char *)from, O_RDONLY|O_EXTRA, 0);
|
fd_in = mch_open((char *)from, O_RDONLY, 0);
|
||||||
if (fd_in == -1) {
|
if (fd_in == -1) {
|
||||||
#ifdef HAVE_ACL
|
#ifdef HAVE_ACL
|
||||||
mch_free_acl(acl);
|
mch_free_acl(acl);
|
||||||
@ -5044,7 +5044,7 @@ int vim_rename(char_u *from, char_u *to)
|
|||||||
|
|
||||||
/* Create the new file with same permissions as the original. */
|
/* Create the new file with same permissions as the original. */
|
||||||
fd_out = mch_open((char *)to,
|
fd_out = mch_open((char *)to,
|
||||||
O_CREAT|O_EXCL|O_WRONLY|O_EXTRA|O_NOFOLLOW, (int)perm);
|
O_CREAT|O_EXCL|O_WRONLY|O_NOFOLLOW, (int)perm);
|
||||||
if (fd_out == -1) {
|
if (fd_out == -1) {
|
||||||
close(fd_in);
|
close(fd_in);
|
||||||
#ifdef HAVE_ACL
|
#ifdef HAVE_ACL
|
||||||
|
@ -1111,7 +1111,7 @@ mf_do_open (
|
|||||||
/*
|
/*
|
||||||
* try to open the file
|
* try to open the file
|
||||||
*/
|
*/
|
||||||
flags |= O_EXTRA | O_NOFOLLOW;
|
flags |= O_NOFOLLOW;
|
||||||
mfp->mf_fd = mch_open_rw((char *)mfp->mf_fname, flags);
|
mfp->mf_fd = mch_open_rw((char *)mfp->mf_fname, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,7 +609,7 @@ void ml_setname(buf_T *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mfp->mf_fd == -1) { /* need to (re)open the swap file */
|
if (mfp->mf_fd == -1) { /* need to (re)open the swap file */
|
||||||
mfp->mf_fd = mch_open((char *)mfp->mf_fname, O_RDWR | O_EXTRA, 0);
|
mfp->mf_fd = mch_open((char *)mfp->mf_fname, O_RDWR, 0);
|
||||||
if (mfp->mf_fd < 0) {
|
if (mfp->mf_fd < 0) {
|
||||||
/* could not (re)open the swap file, what can we do???? */
|
/* could not (re)open the swap file, what can we do???? */
|
||||||
EMSG(_("E301: Oops, lost the swap file!!!"));
|
EMSG(_("E301: Oops, lost the swap file!!!"));
|
||||||
@ -1751,7 +1751,7 @@ static time_t swapfile_info(char_u *fname)
|
|||||||
/*
|
/*
|
||||||
* print the original file name
|
* print the original file name
|
||||||
*/
|
*/
|
||||||
fd = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0);
|
fd = mch_open((char *)fname, O_RDONLY, 0);
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
if (read_eintr(fd, &b0, sizeof(b0)) == sizeof(b0)) {
|
if (read_eintr(fd, &b0, sizeof(b0)) == sizeof(b0)) {
|
||||||
if (STRNCMP(b0.b0_version, "VIM 3.0", 7) == 0) {
|
if (STRNCMP(b0.b0_version, "VIM 3.0", 7) == 0) {
|
||||||
@ -3679,17 +3679,17 @@ findswapname (
|
|||||||
/*
|
/*
|
||||||
* may need to create the files to be able to use mch_stat()
|
* may need to create the files to be able to use mch_stat()
|
||||||
*/
|
*/
|
||||||
f1 = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0);
|
f1 = mch_open((char *)fname, O_RDONLY, 0);
|
||||||
if (f1 < 0) {
|
if (f1 < 0) {
|
||||||
f1 = mch_open_rw((char *)fname,
|
f1 = mch_open_rw((char *)fname,
|
||||||
O_RDWR|O_CREAT|O_EXCL|O_EXTRA);
|
O_RDWR|O_CREAT|O_EXCL);
|
||||||
created1 = TRUE;
|
created1 = TRUE;
|
||||||
}
|
}
|
||||||
if (f1 >= 0) {
|
if (f1 >= 0) {
|
||||||
f2 = mch_open((char *)fname2, O_RDONLY | O_EXTRA, 0);
|
f2 = mch_open((char *)fname2, O_RDONLY, 0);
|
||||||
if (f2 < 0) {
|
if (f2 < 0) {
|
||||||
f2 = mch_open_rw((char *)fname2,
|
f2 = mch_open_rw((char *)fname2,
|
||||||
O_RDWR|O_CREAT|O_EXCL|O_EXTRA);
|
O_RDWR|O_CREAT|O_EXCL);
|
||||||
created2 = TRUE;
|
created2 = TRUE;
|
||||||
}
|
}
|
||||||
if (f2 >= 0) {
|
if (f2 >= 0) {
|
||||||
@ -3787,7 +3787,7 @@ findswapname (
|
|||||||
* Try to read block 0 from the swap file to get the original
|
* Try to read block 0 from the swap file to get the original
|
||||||
* file name (and inode number).
|
* file name (and inode number).
|
||||||
*/
|
*/
|
||||||
fd = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0);
|
fd = mch_open((char *)fname, O_RDONLY, 0);
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
if (read_eintr(fd, &b0, sizeof(b0)) == sizeof(b0)) {
|
if (read_eintr(fd, &b0, sizeof(b0)) == sizeof(b0)) {
|
||||||
/*
|
/*
|
||||||
|
@ -1155,7 +1155,7 @@ void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash)
|
|||||||
if (os_file_exists(file_name)) {
|
if (os_file_exists(file_name)) {
|
||||||
if (name == NULL || !forceit) {
|
if (name == NULL || !forceit) {
|
||||||
/* Check we can read it and it's an undo file. */
|
/* Check we can read it and it's an undo file. */
|
||||||
fd = mch_open((char *)file_name, O_RDONLY|O_EXTRA, 0);
|
fd = mch_open((char *)file_name, O_RDONLY, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
if (name != NULL || p_verbose > 0) {
|
if (name != NULL || p_verbose > 0) {
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
@ -1200,7 +1200,7 @@ void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fd = mch_open((char *)file_name,
|
fd = mch_open((char *)file_name,
|
||||||
O_CREAT|O_EXTRA|O_WRONLY|O_EXCL|O_NOFOLLOW, perm);
|
O_CREAT|O_WRONLY|O_EXCL|O_NOFOLLOW, perm);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
EMSG2(_(e_not_open), file_name);
|
EMSG2(_(e_not_open), file_name);
|
||||||
goto theend;
|
goto theend;
|
||||||
|
12
src/vim.h
12
src/vim.h
@ -34,12 +34,6 @@
|
|||||||
# if (SIZEOF_INT == 0)
|
# if (SIZEOF_INT == 0)
|
||||||
Error: configure did not run properly.Check auto/config.log.
|
Error: configure did not run properly.Check auto/config.log.
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Cygwin may have fchdir() in a newer release, but in most versions it
|
|
||||||
* doesn't work well and avoiding it keeps the binary backward compatible.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* user ID of root is usually zero, but not for everybody */
|
/* user ID of root is usually zero, but not for everybody */
|
||||||
@ -978,12 +972,6 @@ typedef enum {
|
|||||||
# define APPENDBIN "a"
|
# define APPENDBIN "a"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* EMX doesn't have a global way of making open() use binary I/O.
|
|
||||||
* Use O_BINARY for all open() calls.
|
|
||||||
*/
|
|
||||||
# define O_EXTRA 0
|
|
||||||
|
|
||||||
#ifndef O_NOFOLLOW
|
#ifndef O_NOFOLLOW
|
||||||
# define O_NOFOLLOW 0
|
# define O_NOFOLLOW 0
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user