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
This commit is contained in:
pnallan
2019-10-08 09:16:47 -04:00
committed by Anthony Green
parent e5f0eb1552
commit 55c22092dc
+13 -2
View File
@@ -789,7 +789,13 @@ dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset)
close (execfd); close (execfd);
goto retry_open; 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; return MFAIL;
} }
else if (!offset else if (!offset
@@ -801,7 +807,12 @@ dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset)
if (start == MFAIL) if (start == MFAIL)
{ {
munmap (ptr, length); 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; return start;
} }