diff options
author | pnallan <46887249+pnallan@users.noreply.github.com> | 2019-10-08 18:46:47 +0530 |
---|---|---|
committer | Anthony Green <green@moxielogic.com> | 2019-10-08 09:16:47 -0400 |
commit | 55c22092dc54e706a64af3a49ae9d5471a9e8317 (patch) | |
tree | a21f669e49c2cf6fa5a25ba95ff5f6c9c31e8ba0 /src | |
parent | e5f0eb1552f222eb2630e40ee348b090d56412a3 (diff) | |
download | libffi-55c22092dc54e706a64af3a49ae9d5471a9e8317.tar.gz |
handle compilation warnings with ftruncate API (#508)
* fix me: avoid warning while handle ftruncate API
Signed-off-by: Prasad Nallani <prasad.nallani@intel.com>
* Update closures.c
Diffstat (limited to 'src')
-rw-r--r-- | src/closures.c | 15 |
1 files 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; } |