From c84e3d0e0599f48a6f030957db93ef6af0d201e4 Mon Sep 17 00:00:00 2001 From: Daniel Poelzleithner Date: Fri, 3 Jun 2022 05:06:33 +0200 Subject: [PATCH] fix compile warning about write() return code --- lsyncd.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lsyncd.c b/lsyncd.c index d5e0821..816f23c 100644 --- a/lsyncd.c +++ b/lsyncd.c @@ -755,9 +755,16 @@ write_pidfile snprintf( buf, sizeof( buf ), "%i\n", getpid( ) ); - write( pidfile_fd, buf, strlen( buf ) ); + if (write( pidfile_fd, buf, strlen( buf ) ) != strlen(buf)) { + printlogf( + L, "Error", + "Cannot write pidfile; '%s'", + pidfile + ); + + safeexit(L, -1 ); + } - //fclose( f ); }