I noticed this while adding "const" attributes...

>From 4f737ead88df185c058f17150d61420f3920a0b1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Fri, 27 Mar 2009 17:11:33 +0100
Subject: [PATCH] logsys: detect write failure and avoid a file descriptor leak

* exec/logsys.c (logsys_log_rec_store): Close output file descriptor
and detect any failure.
---
 exec/logsys.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/exec/logsys.c b/exec/logsys.c
index 3fb43ab..971e63b 100644
--- a/exec/logsys.c
+++ b/exec/logsys.c
@@ -1081,6 +1081,8 @@ int logsys_log_rec_store (const char *filename)
        }

        written_size = write (fd, flt_data, size_to_write);
+       if (close (fd) != 0)
+               return (-1);
        if (written_size < 0) {
                return (-1);
        } else if ((size_t)written_size != size_to_write) {
--
1.6.2.rc1.285.gc5f54
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to