[vlc-commits] posix: preserve errno on error

Rémi Denis-Courmont git at videolan.org
Mon Oct 29 20:11:08 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Oct 29 21:03:30 2018 +0200| [8d699d9c7bad97179196a641425a9f263415f4a1] | committer: Rémi Denis-Courmont

posix: preserve errno on error

Do not use -1 as file descriptor, which overwrites errno with EBADF.

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

 src/posix/picture.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/posix/picture.c b/src/posix/picture.c
index ea0a3c3ed2..c8395aaf6c 100644
--- a/src/posix/picture.c
+++ b/src/posix/picture.c
@@ -33,6 +33,8 @@
 void *picture_Allocate(int *restrict fdp, size_t size)
 {
     int fd = vlc_memfd();
+    if (fd == -1)
+        return NULL;
 
     if (ftruncate(fd, size)) {
 error:



More information about the vlc-commits mailing list