From 55c22092dc54e706a64af3a49ae9d5471a9e8317 Mon Sep 17 00:00:00 2001 From: pnallan <46887249+pnallan@users.noreply.github.com> Date: Tue, 8 Oct 2019 18:46:47 +0530 Subject: [PATCH] handle compilation warnings with ftruncate API (#508) * fix me: avoid warning while handle ftruncate API Signed-off-by: Prasad Nallani * Update closures.c --- src/closures.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/closures.c b/src/closures.c index adb60bb..86e74c2 100644 --- a/src/closures.c +++ b/src/closures.c @@ -789,7 +789,13 @@ dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset) close (execfd); goto retry_open; } - ftruncate (execfd, offset); + if (ftruncate (execfd, offset) != 0) + { + /* Fixme : Error logs can be added here. Returning an error for + * ftruncte() will not add any advantage as it is being + * validating in the error case. */ + } + return MFAIL; } else if (!offset @@ -801,7 +807,12 @@ dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset) if (start == MFAIL) { munmap (ptr, length); - ftruncate (execfd, offset); + if (ftruncate (execfd, offset) != 0) + { + /* Fixme : Error logs can be added here. Returning an error for + * ftruncte() will not add any advantage as it is being + * validating in the error case. */ + } return start; }