summaryrefslogtreecommitdiff
path: root/libutil/logout.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-04-05 17:27:41 (GMT)
committerDenys Vlasenko <vda.linux@googlemail.com>2010-04-05 17:27:41 (GMT)
commitb2f0faf04264c13d7877646330da7f5954380342 (patch)
tree5250f364c843fdb62bcfbd285df36c176b7c49b2 /libutil/logout.c
parent56f80b6cb62323fbaf0fc8620d10fc242e136ee6 (diff)
libutil/login: was totally broken. fixed
Also made login() and logout() usable with utmpname(non_std_utmp_file) text data bss dec hex filename 111 0 0 111 6f libutil/login.o 217 0 0 217 d9 libutil/login.o text data bss dec hex filename 164 0 0 164 a4 libutil/logout.o 134 0 0 134 86 libutil/logout.o Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libutil/logout.c')
-rw-r--r--libutil/logout.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/libutil/logout.c b/libutil/logout.c
index e6d9565..5f58b8f 100644
--- a/libutil/logout.c
+++ b/libutil/logout.c
@@ -29,9 +29,9 @@ logout (const char *line)
struct utmp *ut;
int result = 0;
- /* Tell that we want to use the UTMP file. */
- if (utmpname (_PATH_UTMP) == -1)
- return 0;
+ /* if (utmpname (_PATH_UTMP) == -1) return 0; - why?
+ * this makes it impossible for caller to use other file!
+ * Does any standard or historical precedent says this must be done? */
/* Open UTMP file. */
setutent ();
@@ -43,7 +43,7 @@ logout (const char *line)
strncpy (tmp.ut_line, line, sizeof tmp.ut_line);
/* Read the record. */
- if( (ut = getutline(&tmp)) )
+ if ((ut = getutline(&tmp)) != NULL)
{
/* Clear information about who & from where. */
memset (ut->ut_name, 0, sizeof ut->ut_name);
@@ -54,12 +54,12 @@ logout (const char *line)
# if !defined __WORDSIZE_COMPAT32 || __WORDSIZE_COMPAT32 == 0
gettimeofday (&ut->ut_tv, NULL);
# else
- {
- struct timeval tv;
- gettimeofday (&tv, NULL);
- ut->ut_tv.tv_sec = tv.tv_sec;
- ut->ut_tv.tv_usec = tv.tv_usec;
- }
+ {
+ struct timeval tv;
+ gettimeofday (&tv, NULL);
+ ut->ut_tv.tv_sec = tv.tv_sec;
+ ut->ut_tv.tv_usec = tv.tv_usec;
+ }
# endif
#else
time (&ut->ut_time);