vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Fri Apr 22 
00:17:45 2016 +0300| [41715334294d5abbc0589bca1af29c9a571540a6] | committer: 
Rémi Denis-Courmont

posix: use posix_close() where available

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=41715334294d5abbc0589bca1af29c9a571540a6
---

 src/posix/filesystem.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/posix/filesystem.c b/src/posix/filesystem.c
index dd516e1..52a39c9 100644
--- a/src/posix/filesystem.c
+++ b/src/posix/filesystem.c
@@ -134,7 +134,17 @@ int vlc_memfd (void)
 
 int vlc_close (int fd)
 {
-    return close (fd);
+#ifdef POSIX_CLOSE_RESTART
+    return posix_close (fd, 0);
+#else
+    int ret = close (fd);
+    /* POSIX.2008 (and earlier) does not specify if the file descriptor is
+     * closed on failure. Assume it is as on Linux and most other common OSes.
+     * Also emulate the correct error code as per newer POSIX versions. */
+    if (unlikely(ret != 0) && unlikely(errno == EINTR))
+        errno = EINPROGRESS;
+    return ret;
+#endif
 }
 
 int vlc_mkdir (const char *dirname, mode_t mode)

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to