• Paul Eggert's avatar
    When renaming a file, ask only if EEXIST or ENOSYS · 1f9f514e
    Paul Eggert authored
    * src/fileio.c (Frename_file): Avoid calling Ffile_directory_p
    more than once on FILE.  Use renameat_noreplace, so that we can
    ask the user (and unlink and retry) only if this fails with errno
    == EEXIST or ENOSYS.  This avoids the need to ask the user for
    permission to do an operation that will fail anyway.  Simplify
    computation of ok_if_already_exists for subsidiary functions.
    * src/filelock.c (rename_lock_file): Prefer renameat_noreplace
    if it works, as this avoids the need to link and unlink.
    * src/lisp.h (renameat_noreplace): New decl.
    * src/sysdep.c [HAVE_LINUX_FS_H]: Include linux/fs.h and sys/syscall.h.
    (renameat_noreplace): New function.
    1f9f514e
filelock.c 24.3 KB