* [PATCH] login: remove file descriptor leak [cppcheck]
@ 2013-02-20 21:31 Sami Kerola
2013-03-04 11:31 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Sami Kerola @ 2013-02-20 21:31 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
[login-utils/login.c:510]: (error) Resource leak: fd
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
login-utils/login.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/login-utils/login.c b/login-utils/login.c
index a17083b..4250534 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
--
1.8.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] login: remove file descriptor leak [cppcheck]
2013-02-20 21:31 [PATCH] login: remove file descriptor leak [cppcheck] Sami Kerola
@ 2013-03-04 11:31 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2013-03-04 11:31 UTC (permalink / raw)
To: Sami Kerola; +Cc: util-linux
On Wed, Feb 20, 2013 at 09:31:09PM +0000, Sami Kerola wrote:
> login-utils/login.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-04 11:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-20 21:31 [PATCH] login: remove file descriptor leak [cppcheck] Sami Kerola
2013-03-04 11:31 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox