From a871942229ef1770da3edec7e1b57194456f4f5d Mon Sep 17 00:00:00 2001 From: On behalf of John Marshall Date: Fri, 4 Sep 2009 16:46:25 +0000 Subject: [PATCH] Return NULL from _razf_open() (and hence razf_open()/razf_open2()) when opening the file fails. --- razf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/razf.c b/razf.c index a5e8f51..ea4e37d 100644 --- a/razf.c +++ b/razf.c @@ -409,6 +409,7 @@ static inline RAZF* _razf_open(const char *filename, const char *mode, int _load #else fd = open(filename, O_RDONLY); #endif + if(fd < 0) return NULL; rz = razf_open_r(fd, _load_index); } else if(strstr(mode, "w")){ #ifdef _WIN32 @@ -416,6 +417,7 @@ static inline RAZF* _razf_open(const char *filename, const char *mode, int _load #else fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); #endif + if(fd < 0) return NULL; rz = razf_open_w(fd); } else return NULL; return rz; -- 2.39.5