summaryrefslogtreecommitdiff
path: root/src/uptime.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-07-13 03:56:29 +0000
committerJim Meyering <jim@meyering.net>1997-07-13 03:56:29 +0000
commit393e4a8c36a42e172b4bea8d5e22e02bb05cbdce (patch)
treec782656b97211c1136453dedc9b1f275263707fd /src/uptime.c
parentaba02b5978b5902fb8fdad11770cfc957e3c0fea (diff)
downloadcoreutils-393e4a8c36a42e172b4bea8d5e22e02bb05cbdce.tar.xz
(uptime): Update read_utmp caller.
Diffstat (limited to 'src/uptime.c')
-rw-r--r--src/uptime.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/uptime.c b/src/uptime.c
index ec7c3886d..b2e7cb6cd 100644
--- a/src/uptime.c
+++ b/src/uptime.c
@@ -41,9 +41,8 @@ static struct option const longopts[] =
};
static void
-print_uptime (int n)
+print_uptime (int n, const STRUCT_UTMP *this)
{
- register STRUCT_UTMP *this = utmp_contents;
register int entries = 0;
time_t boot_time = 0;
time_t time_now;
@@ -143,8 +142,14 @@ print_uptime (int n)
static void
uptime (const char *filename)
{
- int n_users = read_utmp (filename);
- print_uptime (n_users);
+ int n_users;
+ STRUCT_UTMP *utmp_buf;
+ int fail = read_utmp (filename, &n_users, &utmp_buf);
+
+ if (fail)
+ error (1, errno, "%s", filename);
+
+ print_uptime (n_users, utmp_buf);
}
static void