diff options
author | Stefan Hoffmann <stefan991@gmail.com> | 2014-04-25 16:01:41 +0200 |
---|---|---|
committer | Stefan Hoffmann <stefan991@gmail.com> | 2014-05-09 15:49:32 +0200 |
commit | edbb687b73877d8db8b1c6e376e3422bb85a11a9 (patch) | |
tree | f4b6af6d46561876e3aa559ca75621a92f7bbe3f /src/undo.c | |
parent | f3dda65de157f2d7c35286018c20cbc7597ed748 (diff) | |
download | rneovim-edbb687b73877d8db8b1c6e376e3422bb85a11a9.tar.gz rneovim-edbb687b73877d8db8b1c6e376e3422bb85a11a9.tar.bz2 rneovim-edbb687b73877d8db8b1c6e376e3422bb85a11a9.zip |
replaced some mch_stat() with os_file_exists()
Diffstat (limited to 'src/undo.c')
-rw-r--r-- | src/undo.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/undo.c b/src/undo.c index a17ba50255..b93a3e6e32 100644 --- a/src/undo.c +++ b/src/undo.c @@ -675,7 +675,6 @@ char_u *u_get_undo_file_name(char_u *buf_ffname, int reading) char_u *undo_file_name = NULL; int dir_len; char_u *p; - struct stat st; char_u *ffname = buf_ffname; #ifdef HAVE_READLINK char_u fname_buf[MAXPATHL]; @@ -723,7 +722,7 @@ char_u *u_get_undo_file_name(char_u *buf_ffname, int reading) // When reading check if the file exists. if (undo_file_name != NULL && - (!reading || mch_stat((char *)undo_file_name, &st) >= 0)) { + (!reading || os_file_exists(undo_file_name))) { break; } free(undo_file_name); @@ -1108,7 +1107,6 @@ void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash) int perm; int write_ok = FALSE; #ifdef UNIX - int st_old_valid = FALSE; struct stat st_old; struct stat st_new; #endif @@ -1135,16 +1133,10 @@ void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash) */ perm = 0600; if (buf->b_ffname != NULL) { -#ifdef UNIX - if (mch_stat((char *)buf->b_ffname, &st_old) >= 0) { - perm = st_old.st_mode; - st_old_valid = TRUE; - } -#else perm = os_getperm(buf->b_ffname); - if (perm < 0) + if (perm < 0) { perm = 0600; -#endif + } } /* strip any s-bit */ @@ -1223,7 +1215,7 @@ void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash) * this fails, set the protection bits for the group same as the * protection bits for others. */ - if (st_old_valid + if (mch_stat((char *)buf->b_ffname, &st_old) >= 0 && mch_stat((char *)file_name, &st_new) >= 0 && st_new.st_gid != st_old.st_gid # ifdef HAVE_FCHOWN /* sequent-ptx lacks fchown() */ |