summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/utmps/getutxent.c2
-rw-r--r--src/utmps/getutxid.c2
-rw-r--r--src/utmps/getutxline.c2
-rw-r--r--src/utmps/pututxline.c2
-rw-r--r--src/utmps/setutxent.c2
-rw-r--r--src/utmps/utmps-internal.h2
-rw-r--r--src/utmps/utmps_here_maybe_init.c5
7 files changed, 8 insertions, 9 deletions
diff --git a/src/utmps/getutxent.c b/src/utmps/getutxent.c
index 97a5917..688630f 100644
--- a/src/utmps/getutxent.c
+++ b/src/utmps/getutxent.c
@@ -6,7 +6,7 @@
struct utmpx *getutxent (void)
{
- utmps_here_maybe_init() ;
+ if (!utmps_here_maybe_init()) return 0 ;
if (!utmps_getent(&utmps_here, &utmps_utmpx_here, 0, 0)) return 0 ;
return &utmps_utmpx_here ;
}
diff --git a/src/utmps/getutxid.c b/src/utmps/getutxid.c
index 262f35c..b6e66ab 100644
--- a/src/utmps/getutxid.c
+++ b/src/utmps/getutxid.c
@@ -6,7 +6,7 @@
struct utmpx *getutxid (struct utmpx const *b)
{
- utmps_here_maybe_init() ;
+ if (!utmps_here_maybe_init()) return 0 ;
if (!utmps_getid(&utmps_here, (unsigned short)b->ut_type, b->ut_id, &utmps_utmpx_here, 0, 0)) return 0 ;
return &utmps_utmpx_here ;
}
diff --git a/src/utmps/getutxline.c b/src/utmps/getutxline.c
index e950816..daff189 100644
--- a/src/utmps/getutxline.c
+++ b/src/utmps/getutxline.c
@@ -6,7 +6,7 @@
struct utmpx *getutxline (struct utmpx const *b)
{
- utmps_here_maybe_init() ;
+ if (!utmps_here_maybe_init()) return 0 ;
if (!utmps_getline(&utmps_here, b->ut_line, &utmps_utmpx_here, 0, 0)) return 0 ;
return &utmps_utmpx_here ;
}
diff --git a/src/utmps/pututxline.c b/src/utmps/pututxline.c
index 4e149d8..f60931d 100644
--- a/src/utmps/pututxline.c
+++ b/src/utmps/pututxline.c
@@ -7,7 +7,7 @@
struct utmpx *pututxline (struct utmpx const *b)
{
static struct utmpx here ; /* POSIX says we can't use utmps_utmpx_here */
- utmps_here_maybe_init() ;
+ if (!utmps_here_maybe_init()) return 0 ;
if (!utmps_putline(&utmps_here, b, 0, 0)) return 0 ;
here = *b ;
return &here ;
diff --git a/src/utmps/setutxent.c b/src/utmps/setutxent.c
index b8b8199..b6d4913 100644
--- a/src/utmps/setutxent.c
+++ b/src/utmps/setutxent.c
@@ -6,6 +6,6 @@
void setutxent (void)
{
- utmps_here_maybe_init() ;
+ if (!utmps_here_maybe_init()) return ;
utmps_rewind(&utmps_here, 0, 0) ;
}
diff --git a/src/utmps/utmps-internal.h b/src/utmps/utmps-internal.h
index 476e100..9a51dcc 100644
--- a/src/utmps/utmps-internal.h
+++ b/src/utmps/utmps-internal.h
@@ -8,7 +8,7 @@
extern struct utmpx utmps_utmpx_here ;
extern utmps utmps_here ;
-extern void utmps_here_maybe_init (void) ;
+extern int utmps_here_maybe_init (void) ;
extern void utmps_utmpx_pack (char *, struct utmpx const *) ;
extern void utmps_utmpx_unpack (char const *, struct utmpx *) ;
diff --git a/src/utmps/utmps_here_maybe_init.c b/src/utmps/utmps_here_maybe_init.c
index 4f3e207..d40e139 100644
--- a/src/utmps/utmps_here_maybe_init.c
+++ b/src/utmps/utmps_here_maybe_init.c
@@ -4,8 +4,7 @@
#include <utmps/utmps.h>
#include "utmps-internal.h"
-void utmps_here_maybe_init (void)
+int utmps_here_maybe_init (void)
{
- if (utmps_here.fd < 0)
- utmps_start(&utmps_here, UTMPS_UTMPD_PATH, 0, 0) ;
+ return utmps_here.fd >= 0 || utmps_start(&utmps_here, UTMPS_UTMPD_PATH, 0, 0) ;
}