#include "lisp.h"
#include "buffer.h"
+#include "charset.h"
+#include "coding.h"
#include <time.h>
#include <errno.h>
return boot_time;
utmpname ("/var/log/wtmp");
- ut.ut_type = BOOT_TIME;
- utp = getutid (&ut);
+ setutent ();
+ boot_time = 1;
+ while (1)
+ {
+ /* Find the next reboot record. */
+ ut.ut_type = BOOT_TIME;
+ utp = getutid (&ut);
+ if (! utp)
+ break;
+ /* Compare reboot times and use the newest one. */
+ if (utp->ut_time > boot_time)
+ boot_time = utp->ut_time;
+ /* Advance on element in the file
+ so that getutid won't repeat the same one. */
+ utp = getutent ();
+ if (! utp)
+ break;
+ }
endutent ();
- if (!utp)
- return boot_time = 1;
- return boot_time = utp->ut_time;
+ return boot_time;
#else
return 0;
#endif
void
lock_file (fn)
- register Lisp_Object fn;
+ Lisp_Object fn;
{
- register Lisp_Object attack, orig_fn;
+ register Lisp_Object attack, orig_fn, encoded_fn;
register char *lfname, *locker;
lock_info_type lock_info;
orig_fn = fn;
fn = Fexpand_file_name (fn, Qnil);
+ encoded_fn = ENCODE_FILE (fn);
/* Create the name of the lock-file for file fn */
- MAKE_LOCK_NAME (lfname, fn);
+ MAKE_LOCK_NAME (lfname, encoded_fn);
/* See if this file is visited and has changed on disk since it was
visited. */
{
register Lisp_Object subject_buf;
- struct gcpro1;
+ struct gcpro gcpro1;
subject_buf = get_truename_buffer (orig_fn);
GCPRO1 (fn);
register char *lfname;
fn = Fexpand_file_name (fn, Qnil);
+ fn = ENCODE_FILE (fn);
MAKE_LOCK_NAME (lfname, fn);