tweaks: rename a variable, to fit a little better

master
Benno Schulenberg 2019-06-12 11:03:03 +02:00
parent 43caf7bb7b
commit 3da4240229
1 changed files with 5 additions and 6 deletions

View File

@ -1554,9 +1554,8 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
mode_t original_umask = 0; mode_t original_umask = 0;
/* Our umask, from when nano started. */ /* Our umask, from when nano started. */
#ifndef NANO_TINY #ifndef NANO_TINY
bool realexists = FALSE; bool isactualfile = FALSE;
/* The result of stat(). TRUE if the file exists, FALSE otherwise. /* TRUE when the file is non-temporary and exists, FALSE otherwise. */
* If name is a link that points nowhere, realexists is FALSE. */
#endif #endif
struct stat st; struct stat st;
/* The status fields filled in by stat(). */ /* The status fields filled in by stat(). */
@ -1591,13 +1590,13 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
#ifndef NANO_TINY #ifndef NANO_TINY
/* Check whether the file (at the end of the symlink) exists. */ /* Check whether the file (at the end of the symlink) exists. */
if (!tmp) if (!tmp)
realexists = (stat(realname, &st) != -1); isactualfile = (stat(realname, &st) != -1);
/* If we haven't stat()d this file before (say, the user just /* If we haven't stat()d this file before (say, the user just
* specified it interactively), stat and save the value now, * specified it interactively), stat and save the value now,
* or else we will chase null pointers when we do modtime checks, * or else we will chase null pointers when we do modtime checks,
* preserve file times, and so on, during backup. */ * preserve file times, and so on, during backup. */
if (openfile->current_stat == NULL && realexists) if (openfile->current_stat == NULL && isactualfile)
stat_with_alloc(realname, &openfile->current_stat); stat_with_alloc(realname, &openfile->current_stat);
/* We backup only if the backup toggle is set, the file isn't /* We backup only if the backup toggle is set, the file isn't
@ -1605,7 +1604,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
* aren't appending, prepending, or writing a selection, we backup * aren't appending, prepending, or writing a selection, we backup
* only if the file has not been modified by someone else since nano * only if the file has not been modified by someone else since nano
* opened it. */ * opened it. */
if (ISSET(BACKUP_FILE) && realexists && openfile->current_stat && if (ISSET(BACKUP_FILE) && isactualfile && openfile->current_stat &&
(method != OVERWRITE || openfile->mark || (method != OVERWRITE || openfile->mark ||
openfile->current_stat->st_mtime == st.st_mtime)) { openfile->current_stat->st_mtime == st.st_mtime)) {
static struct timespec filetime[2]; static struct timespec filetime[2];