summaryrefslogtreecommitdiffstats
path: root/login-utils/login.c
diff options
context:
space:
mode:
Diffstat (limited to 'login-utils/login.c')
-rw-r--r--login-utils/login.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/login-utils/login.c b/login-utils/login.c
index a17083b5f..425053406 100644
--- a/login-utils/login.c
+++ b/login-utils/login.c
@@ -506,8 +506,10 @@ static void log_lastlog(struct login_context *cxt)
if (fd < 0)
return;
- if (lseek(fd, (off_t) cxt->pwd->pw_uid * sizeof(ll), SEEK_SET) == -1)
+ if (lseek(fd, (off_t) cxt->pwd->pw_uid * sizeof(ll), SEEK_SET) == -1) {
+ close(fd);
return;
+ }
/*
* Print last log message