Skip to content

Commit

Permalink
wmtpdb: call wtmpdb_* functions with NULL as path
Browse files Browse the repository at this point in the history
wtmpdb_*() funtions can only use the varlink interface if no wtmpdb path is
specified. By default call it with NULL, only use a path if specified by
the user.
  • Loading branch information
thkukuk committed Dec 18, 2024
1 parent 2000e36 commit 27f9e01
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/wtmpdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

#include "wtmpdb.h"

static char *wtmpdb_path = _PATH_WTMPDB;
static char *wtmpdb_path = NULL;

#define TIMEFMT_CTIME 1
#define TIMEFMT_SHORT 2
Expand Down Expand Up @@ -794,13 +794,13 @@ main_last (int argc, char **argv)
}

if (wtmp_start == UINT64_MAX)
printf ("%s has no entries\n", wtmpdb_path);
printf ("%s has no entries\n", wtmpdb_path?wtmpdb_path:"wtmpdb");
else if (time_fmt != TIMEFMT_NOTIME)
{
char wtmptime[32];
format_time (time_fmt, wtmptime, sizeof (wtmptime),
wtmp_start/USEC_PER_SEC);
printf ("\n%s begins %s\n", wtmpdb_path, wtmptime);
printf ("\n%s begins %s\n", wtmpdb_path?wtmpdb_path:"wtmpdb", wtmptime);
}
return EXIT_SUCCESS;
}
Expand Down

0 comments on commit 27f9e01

Please sign in to comment.