From 7b70e84576a8b2d39fddb57570cd505a433d0e24 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Sat, 14 Oct 2006 00:17:48 +0000 Subject: [PATCH] Call fileno and krb5_lock_file before calling fclose, rather than after. Caught by valgrind. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18700 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin/dbutil/dump.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/kadmin/dbutil/dump.c b/src/kadmin/dbutil/dump.c index 12b6a46ef..e1f1d8848 100644 --- a/src/kadmin/dbutil/dump.c +++ b/src/kadmin/dbutil/dump.c @@ -1190,8 +1190,12 @@ dump_db(argc, argv) exit_status++; } if (ofile && f != stdout && !exit_status) { - fclose(f); - update_ok_file(ofile); + if (locked) { + (void) krb5_lock_file(util_context, fileno(f), KRB5_LOCKMODE_UNLOCK); + locked = 0; + } + fclose(f); + update_ok_file(ofile); } } if (locked) -- 2.26.2