diff options
Diffstat (limited to 'src/filelock.c')
-rw-r--r-- | src/filelock.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/filelock.c b/src/filelock.c index b9c991e4baf..0f31b7d4deb 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -411,28 +411,14 @@ create_lock_file (char *lfname, char *lock_info_str, bool force) memcpy (nonce, lfname, lfdirlen); strcpy (nonce + lfdirlen, nonce_base); -#if HAVE_MKOSTEMP - /* Prefer mkostemp to mkstemp, as it avoids a window where FD is - temporarily open without close-on-exec. */ fd = mkostemp (nonce, O_BINARY | O_CLOEXEC); -#elif HAVE_MKSTEMP - /* Prefer mkstemp to mktemp, as it avoids a race between - mktemp and emacs_open. */ - fd = mkstemp (nonce); -#else - mktemp (nonce); - fd = emacs_open (nonce, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, - S_IRUSR | S_IWUSR); -#endif - if (fd < 0) err = errno; else { ptrdiff_t lock_info_len; -#if ! (HAVE_MKOSTEMP && O_CLOEXEC) - fcntl (fd, F_SETFD, FD_CLOEXEC); -#endif + if (! O_CLOEXEC) + fcntl (fd, F_SETFD, FD_CLOEXEC); lock_info_len = strlen (lock_info_str); err = 0; /* Use 'write', not 'emacs_write', as garbage collection |