From 596fc68aca17edbc2bac79cdfe4073d227579fab Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 30 Jan 2014 16:24:48 -0700 Subject: [PATCH] Warn on ftruncate failure(). --- plugins/sudoers/timestamp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/sudoers/timestamp.c b/plugins/sudoers/timestamp.c index c14db3dd7..93d0e7bdc 100644 --- a/plugins/sudoers/timestamp.c +++ b/plugins/sudoers/timestamp.c @@ -156,8 +156,12 @@ found_it: debug_return_bool(true); /* Truncate on partial write to be safe. */ - if (nwritten > 0 && old_eof != (off_t)-1) - ftruncate(fd, old_eof); + if (nwritten > 0 && old_eof != (off_t)-1) { + if (ftruncate(fd, old_eof) != 0) { + warning(N_("unable to truncate time stamp file to %lld bytes"), + old_eof); + } + } debug_return_bool(false); } -- 2.40.0