summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2018-02-17 12:16:18 +0800
committerMatt Johnston <matt@ucc.asn.au>2018-02-17 12:16:18 +0800
commitc8d852caf646d060babd4be9d074caee51c5aead (patch)
treed07a1c7b1e0ed6070d3c5169ab605fb5eafd065a
parentf042eb41ab0d31f8ba0c5ccc9c848ad01f08f986 (diff)
loginrec close fd on error path
-rw-r--r--loginrec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/loginrec.c b/loginrec.c
index 7254cf1..af10d95 100644
--- a/loginrec.c
+++ b/loginrec.c
@@ -1330,7 +1330,8 @@ lastlog_openseek(struct logininfo *li, int *fd, int filemode)
if ( lseek(*fd, offset, SEEK_SET) != offset ) {
dropbear_log(LOG_WARNING, "lastlog_openseek: %s->lseek(): %s",
- lastlog_file, strerror(errno));
+ lastlog_file, strerror(errno));
+ m_close(*fd);
return 0;
}
}