From 3ab33cebe43066cc66865c0e2e0ace5fa8b77e4d Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Wed, 6 Mar 2024 09:12:36 +0100 Subject: [PATCH] confd: fix bogus warning about not updating /etc/motd properly Signed-off-by: Joachim Wiberg --- src/confd/src/ietf-system.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/confd/src/ietf-system.c b/src/confd/src/ietf-system.c index 01d54f48..ed04df7c 100644 --- a/src/confd/src/ietf-system.c +++ b/src/confd/src/ietf-system.c @@ -1071,8 +1071,13 @@ static int change_motd_banner(sr_session_ctx_t *session, uint32_t sub_id, const if (!fp) { rc = -1; } else { - if (fwrite(txt, txt_len, sizeof(txt[0]), fp) != txt_len) + size_t len = fwrite(txt, sizeof(txt[0]), txt_len, fp); + + if (len != txt_len) { + ERROR("failed writing %s, wrote %zu bytes of total %zu", + fn, len, txt_len); rc = -1; + } fclose(fp); }