summaryrefslogtreecommitdiff
path: root/src/filelock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/filelock.c')
-rw-r--r--src/filelock.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/filelock.c b/src/filelock.c
index 8aaa656438d..62017188b33 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -193,14 +193,11 @@ get_boot_time (void)
/* If we did not find a boot time in wtmp, look at wtmp, and so on. */
for (counter = 0; counter < 20 && ! boot_time; counter++)
{
+ Lisp_Object filename = Qnil;
+ bool delete_flag = false;
char cmd_string[sizeof WTMP_FILE ".19.gz"];
- Lisp_Object tempname, filename;
- bool delete_flag = 0;
-
- filename = Qnil;
-
- tempname = make_formatted_string
- (cmd_string, "%s.%d", WTMP_FILE, counter);
+ AUTO_STRING_WITH_LEN (tempname, cmd_string,
+ sprintf (cmd_string, "%s.%d", WTMP_FILE, counter));
if (! NILP (Ffile_exists_p (tempname)))
filename = tempname;
else
@@ -220,7 +217,7 @@ get_boot_time (void)
CALLN (Fcall_process, build_string ("gzip"), Qnil,
list2 (QCfile, filename), Qnil,
build_string ("-cd"), tempname);
- delete_flag = 1;
+ delete_flag = true;
}
}
@@ -255,14 +252,7 @@ get_boot_time_1 (const char *filename, bool newest)
struct utmp ut, *utp;
if (filename)
- {
- /* On some versions of IRIX, opening a nonexistent file name
- is likely to crash in the utmp routines. */
- if (faccessat (AT_FDCWD, filename, R_OK, AT_EACCESS) != 0)
- return;
-
- utmpname (filename);
- }
+ utmpname (filename);
setutent ();
@@ -497,7 +487,7 @@ read_lock_data (char *lfname, char lfinfo[MAX_LFINFO + 1])
while ((nbytes = readlinkat (AT_FDCWD, lfname, lfinfo, MAX_LFINFO + 1)) < 0
&& errno == EINVAL)
{
- int fd = emacs_open (lfname, O_RDONLY | O_BINARY | O_NOFOLLOW, 0);
+ int fd = emacs_open (lfname, O_RDONLY | O_NOFOLLOW, 0);
if (0 <= fd)
{
/* Use read, not emacs_read, since FD isn't unwind-protected. */