[27634] in CVS-changelog-for-Kerberos-V5
krb5 commit: Fix a trivial file leak writing kadmind pid file
daemon@ATHENA.MIT.EDU (Greg Hudson)
Tue Mar 26 13:29:43 2013
Date: Tue, 26 Mar 2013 13:29:37 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-Id: <201303261729.r2QHTb8l031513@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu
https://github.com/krb5/krb5/commit/47ec1ab146334f94b97e6572904a14ad67ee2524
commit 47ec1ab146334f94b97e6572904a14ad67ee2524
Author: Greg Hudson <ghudson@mit.edu>
Date: Mon Mar 25 17:38:41 2013 -0400
Fix a trivial file leak writing kadmind pid file
If we fail to write the pid to the pid file, we should still close the
file before returning from write_pid_file(). The consequences of this
bug are trivial because kadmin is just going to exit regardless.
Reported by Will Fiveash <will.fiveash@oracle.com>.
src/kadmin/server/ovsec_kadmd.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/kadmin/server/ovsec_kadmd.c b/src/kadmin/server/ovsec_kadmd.c
index 60a2afb..a1fee7e 100644
--- a/src/kadmin/server/ovsec_kadmd.c
+++ b/src/kadmin/server/ovsec_kadmd.c
@@ -188,14 +188,15 @@ write_pid_file(const char *pid_file)
{
FILE *file;
unsigned long pid;
+ int st1, st2;
file = fopen(pid_file, "w");
if (file == NULL)
return errno;
pid = (unsigned long) getpid();
- if (fprintf(file, "%ld\n", pid) < 0 || fclose(file) == EOF)
- return errno;
- return 0;
+ st1 = fprintf(file, "%ld\n", pid);
+ st2 = fclose(file);
+ return (st1 < 0 || st2 == EOF) ? errno : 0;
}
/* XXX yuck. the signal handlers need this */
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5