Signed-off-by: Angus Salkeld <[email protected]>
---
 exec/coroipcs.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/exec/coroipcs.c b/exec/coroipcs.c
index 9394f21..9d81b7e 100644
--- a/exec/coroipcs.c
+++ b/exec/coroipcs.c
@@ -263,8 +263,9 @@ memory_map (
 
        unlink (path);
 
-       res = ftruncate (fd, bytes);
-
+       if (fd >= 0) {
+               res = ftruncate (fd, bytes);
+       }
        addr_orig = mmap (NULL, bytes, PROT_NONE,
                MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
 
@@ -305,8 +306,9 @@ circular_memory_map (
 
        unlink (path);
 
-       res = ftruncate (fd, bytes);
-
+       if (fd >= 0) {
+               res = ftruncate (fd, bytes);
+       }
        addr_orig = mmap (NULL, bytes << 1, PROT_NONE,
                MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
 
-- 
1.6.6.1

_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to