summaryrefslogtreecommitdiff
path: root/loginrec.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-08-18 14:08:38 +1000
committerDamien Miller <djm@mindrot.org>2000-08-18 14:08:38 +1000
commitc1132e77590706c9e8bf56673a05f1a8b668bc76 (patch)
tree7434728191faf5888aa54705befaae5feab4d19f /loginrec.c
parent61c51508615381765249e6ef1f9f843de2f3d5b6 (diff)
- (djm) Lastlog was not getting closed after writing login entry
Diffstat (limited to 'loginrec.c')
-rw-r--r--loginrec.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/loginrec.c b/loginrec.c
index 6b87ba320..2c6330a04 100644
--- a/loginrec.c
+++ b/loginrec.c
@@ -160,7 +160,7 @@
160#include "xmalloc.h" 160#include "xmalloc.h"
161#include "loginrec.h" 161#include "loginrec.h"
162 162
163RCSID("$Id: loginrec.c,v 1.20 2000/08/15 00:21:17 djm Exp $"); 163RCSID("$Id: loginrec.c,v 1.21 2000/08/18 04:08:38 djm Exp $");
164 164
165/** 165/**
166 ** prototypes for helper functions in this file 166 ** prototypes for helper functions in this file
@@ -1403,17 +1403,19 @@ lastlog_perform_login(struct logininfo *li)
1403 /* create our struct lastlog */ 1403 /* create our struct lastlog */
1404 lastlog_construct(li, &last); 1404 lastlog_construct(li, &last);
1405 1405
1406 if (!lastlog_openseek(li, &fd, O_RDWR|O_CREAT))
1407 return(0);
1408
1406 /* write the entry */ 1409 /* write the entry */
1407 if (lastlog_openseek(li, &fd, O_RDWR|O_CREAT)) { 1410 if (atomicio(write, fd, &last, sizeof(last)) != sizeof(last)) {
1408 if (atomicio(write, fd, &last, sizeof(last)) != sizeof(last)) { 1411 close(fd);
1409 log("lastlog_write_filemode: Error writing to %s: %s", 1412 log("lastlog_write_filemode: Error writing to %s: %s",
1410 LASTLOG_FILE, strerror(errno)); 1413 LASTLOG_FILE, strerror(errno));
1411 return 0;
1412 }
1413 return 1;
1414 } else {
1415 return 0; 1414 return 0;
1416 } 1415 }
1416
1417 close(fd);
1418 return 1;
1417} 1419}
1418 1420
1419int 1421int