Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/cxong/tinydir.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCong <congusbongus@gmail.com>2016-03-12 14:35:27 +0300
committerCong <congusbongus@gmail.com>2016-03-12 14:35:27 +0300
commitddd509c025b3cef59ddabedf89456a71befe2580 (patch)
treed3ff1984dd90590b791bf4967d4820966ef4532a
parent631cd61465e30cd1c433f6aae66ce60a1430a029 (diff)
Avoid setting errno if system already provides one
-rwxr-xr-xtinydir.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/tinydir.h b/tinydir.h
index 5536699..53f2209 100755
--- a/tinydir.h
+++ b/tinydir.h
@@ -169,12 +169,13 @@ int tinydir_open(tinydir_dir *dir, const char *path)
dir->_h = FindFirstFileA(dir->path, &dir->_f);
dir->path[strlen(dir->path) - 2] = '\0';
if (dir->_h == INVALID_HANDLE_VALUE)
+ {
+ errno = ENOENT;
#else
dir->_d = opendir(path);
if (dir->_d == NULL)
-#endif
{
- errno = ENOENT;
+#endif
goto bail;
}
@@ -231,7 +232,6 @@ int tinydir_open_sorted(tinydir_dir *dir, const char *path)
dir->_files = (tinydir_file *)_TINYDIR_MALLOC(sizeof *dir->_files * n_files);
if (dir->_files == NULL)
{
- errno = ENOMEM;
goto bail;
}
while (dir->has_next)