aboutsummaryrefslogtreecommitdiffstats
path: root/src/filelock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/filelock.c')
-rw-r--r--src/filelock.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/filelock.c b/src/filelock.c
index d21d8e7ba02..17f3f253249 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -23,7 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23#include <sys/stat.h> 23#include <sys/stat.h>
24#include <signal.h> 24#include <signal.h>
25#include <stdio.h> 25#include <stdio.h>
26#include <setjmp.h>
27 26
28#ifdef HAVE_PWD_H 27#ifdef HAVE_PWD_H
29#include <pwd.h> 28#include <pwd.h>
@@ -100,10 +99,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
100/* Return the time of the last system boot. */ 99/* Return the time of the last system boot. */
101 100
102static time_t boot_time; 101static time_t boot_time;
103static int boot_time_initialized; 102static bool boot_time_initialized;
104 103
105#ifdef BOOT_TIME 104#ifdef BOOT_TIME
106static void get_boot_time_1 (const char *, int); 105static void get_boot_time_1 (const char *, bool);
107#endif 106#endif
108 107
109static time_t 108static time_t
@@ -170,7 +169,7 @@ get_boot_time (void)
170 { 169 {
171 char cmd_string[sizeof WTMP_FILE ".19.gz"]; 170 char cmd_string[sizeof WTMP_FILE ".19.gz"];
172 Lisp_Object tempname, filename; 171 Lisp_Object tempname, filename;
173 int delete_flag = 0; 172 bool delete_flag = 0;
174 173
175 filename = Qnil; 174 filename = Qnil;
176 175
@@ -225,13 +224,13 @@ get_boot_time (void)
225 224
226 If FILENAME is zero, use the same file as before; 225 If FILENAME is zero, use the same file as before;
227 if no FILENAME has ever been specified, this is the utmp file. 226 if no FILENAME has ever been specified, this is the utmp file.
228 Use the newest reboot record if NEWEST is nonzero, 227 Use the newest reboot record if NEWEST,
229 the first reboot record otherwise. 228 the first reboot record otherwise.
230 Ignore all reboot records on or before BOOT_TIME. 229 Ignore all reboot records on or before BOOT_TIME.
231 Success is indicated by setting BOOT_TIME to a larger value. */ 230 Success is indicated by setting BOOT_TIME to a larger value. */
232 231
233void 232void
234get_boot_time_1 (const char *filename, int newest) 233get_boot_time_1 (const char *filename, bool newest)
235{ 234{
236 struct utmp ut, *utp; 235 struct utmp ut, *utp;
237 int desc; 236 int desc;
@@ -331,11 +330,11 @@ fill_in_lock_file_name (register char *lockfile, register Lisp_Object fn)
331} 330}
332 331
333/* Lock the lock file named LFNAME. 332/* Lock the lock file named LFNAME.
334 If FORCE is nonzero, we do so even if it is already locked. 333 If FORCE, do so even if it is already locked.
335 Return 1 if successful, 0 if not. */ 334 Return true if successful. */
336 335
337static int 336static bool
338lock_file_1 (char *lfname, int force) 337lock_file_1 (char *lfname, bool force)
339{ 338{
340 int err; 339 int err;
341 int symlink_errno; 340 int symlink_errno;
@@ -370,9 +369,9 @@ lock_file_1 (char *lfname, int force)
370 return err == 0; 369 return err == 0;
371} 370}
372 371
373/* Return 1 if times A and B are no more than one second apart. */ 372/* Return true if times A and B are no more than one second apart. */
374 373
375static int 374static bool
376within_one_second (time_t a, time_t b) 375within_one_second (time_t a, time_t b)
377{ 376{
378 return (a - b >= -1 && a - b <= 1); 377 return (a - b >= -1 && a - b <= 1);
@@ -491,7 +490,7 @@ current_lock_owner (lock_info_type *owner, char *lfname)
491static int 490static int
492lock_if_free (lock_info_type *clasher, register char *lfname) 491lock_if_free (lock_info_type *clasher, register char *lfname)
493{ 492{
494 while (lock_file_1 (lfname, 0) == 0) 493 while (! lock_file_1 (lfname, 0))
495 { 494 {
496 int locker; 495 int locker;
497 496