Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
c321b190
Commit
c321b190
authored
May 18, 1998
by
Richard M. Stallman
Browse files
(get_boot_time): Scan the whole wtmp file
to find the most recent reboot.
parent
c519f68f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
+19
-5
src/filelock.c
src/filelock.c
+19
-5
No files found.
src/filelock.c
View file @
c321b190
...
...
@@ -104,13 +104,27 @@ get_boot_time ()
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment