From: mukawa <muk...@igel.co.jp>

In direct_file_close(), 'file->fd' is closed twice if 'file->file'
isn't NULL.
Since'file->file' is assigned the result of fdopen(file->fd, ) in 
direct_fgets(),
fclose(file->file,) also closes 'file->fd', so it doesn't need to be closed 
again with
close(file->fd).
Similary, in direct_pclose() close(file->fd) doesn't need to be called after 
calling
fclose(file->file).

Signed-off-by: Tetsuya Mukawa <muk...@igel.co.jp>
---
 lib/direct/os/linux/glibc/filesystem.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/direct/os/linux/glibc/filesystem.c 
b/lib/direct/os/linux/glibc/filesystem.c
index d04d3e3..0ba9331 100644
--- a/lib/direct/os/linux/glibc/filesystem.c
+++ b/lib/direct/os/linux/glibc/filesystem.c
@@ -118,9 +118,8 @@ direct_file_close( DirectFile *file )
           fclose( file->file );
 
           file->file = NULL;
-     }
-
-     ret = close( file->fd );
+     } else
+          ret = close( file->fd );
 
      file->fd = -1;
 
@@ -250,8 +249,6 @@ direct_pclose( DirectFile *file )
 
      ret = fclose( file->file );
 
-     close( file->fd );
-
      if (ret < 0)
           return errno2result( errno );
 
-- 
1.7.9.5

_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to