From c21467a8f04cd06226a262b98701d50282067b50 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Wed, 19 Aug 2020 07:23:19 +0100 Subject: [PATCH] coverity: 50976: check fsync return for cert write --- lib/plat/unix/unix-misc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/plat/unix/unix-misc.c b/lib/plat/unix/unix-misc.c index ef8a9af18..953c6247f 100644 --- a/lib/plat/unix/unix-misc.c +++ b/lib/plat/unix/unix-misc.c @@ -101,7 +101,8 @@ lws_plat_write_cert(struct lws_vhost *vhost, int is_key, int fd, void *buf, n = write(fd, buf, len); - fsync(fd); + if (fsync(fd)) + return 1; if (lseek(fd, 0, SEEK_SET) < 0) return 1;