From b8aed2b43e3739e089ce587dde26fd905fa1c855 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Wed, 7 Jan 2026 16:55:54 -0600 Subject: [PATCH] kadm5: Check ftruncate() result --- lib/kadm5/log.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/kadm5/log.c b/lib/kadm5/log.c index cbfde885c..e85d9aa1a 100644 --- a/lib/kadm5/log.c +++ b/lib/kadm5/log.c @@ -2624,7 +2624,10 @@ kadm5_log_truncate(kadm5_server_context *context, size_t keep, size_t maxbytes) if (ret) { krb5_warn(context->context, ret, "Unable to keep entries"); - (void) ftruncate(context->log_context.log_fd, LOG_UBER_SZ); + if (ftruncate(context->log_context.log_fd, LOG_UBER_SZ) == -1) { + krb5_warn(context->context, ret, "Unable to truncate log"); + return errno; + } (void) lseek(context->log_context.log_fd, 0, SEEK_SET); return ret; }