diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2020-03-25 13:37:23 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-03-25 13:40:34 -0700 |
commit | 2ea87d6c6f1161801402958bdc6b6a2e6c41c6b8 (patch) | |
tree | b225e1669bc7bfd9380389dc4422216d6c0efd31 /src/filelock.c | |
parent | 11b37a4167d2eee4cb1f467a7f8ebaa6c8667ce9 (diff) | |
download | emacs-2ea87d6c6f1161801402958bdc6b6a2e6c41c6b8.tar.gz emacs-2ea87d6c6f1161801402958bdc6b6a2e6c41c6b8.tar.bz2 emacs-2ea87d6c6f1161801402958bdc6b6a2e6c41c6b8.zip |
Pacify --enable-gcc-warnings for lock_file
* src/filelock.c (lock_file): Pacify gcc -Wmaybe-uninitialized
after recent change to this function.
Diffstat (limited to 'src/filelock.c')
-rw-r--r-- | src/filelock.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/filelock.c b/src/filelock.c index 2b734ee00d5..ee46e0e3e00 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -661,7 +661,7 @@ void lock_file (Lisp_Object fn) { Lisp_Object orig_fn, encoded_fn; - char *lfname; + char *lfname = NULL; lock_info_type lock_info; USE_SAFE_ALLOCA; @@ -686,21 +686,15 @@ lock_file (Lisp_Object fn) /* See if this file is visited and has changed on disk since it was visited. */ - { - register Lisp_Object subject_buf; - - subject_buf = get_truename_buffer (orig_fn); - - if (!NILP (subject_buf) - && NILP (Fverify_visited_file_modtime (subject_buf)) - && !NILP (Ffile_exists_p (fn)) - && (!create_lockfiles || current_lock_owner (NULL, lfname) != -2)) - call1 (intern ("userlock--ask-user-about-supersession-threat"), fn); - - } + Lisp_Object subject_buf = get_truename_buffer (orig_fn); + if (!NILP (subject_buf) + && NILP (Fverify_visited_file_modtime (subject_buf)) + && !NILP (Ffile_exists_p (fn)) + && !(lfname && current_lock_owner (NULL, lfname) == -2)) + call1 (intern ("userlock--ask-user-about-supersession-threat"), fn); /* Don't do locking if the user has opted out. */ - if (create_lockfiles) + if (lfname) { /* Try to lock the lock. FIXME: This ignores errors when lock_if_free returns a positive errno value. */ @@ -860,7 +854,7 @@ syms_of_filelock (void) The name of the (per-buffer) lockfile is constructed by prepending a '.#' to the name of the file being locked. See also `lock-buffer' and Info node `(emacs)Interlocking'. */); - create_lockfiles = 1; + create_lockfiles = true; defsubr (&Sunlock_buffer); defsubr (&Slock_buffer); |