Use -EISDIR instead of -2 in GetFileLength for directories.

This commit is contained in:
Reece H. Dunn
2017-02-04 16:02:56 +00:00
parent d89c6fdcc3
commit df6a2228b7
5 changed files with 19 additions and 10 deletions
+3 -3
View File
@@ -232,14 +232,14 @@ static int check_data_path(const char *path, int allow_directory)
if (!path) return 0;
snprintf(path_home, sizeof(path_home), "%s/espeak-ng-data", path);
if (GetFileLength(path_home) == -2)
if (GetFileLength(path_home) == -EISDIR)
return 1;
if (!allow_directory)
return 0;
snprintf(path_home, sizeof(path_home), "%s", path);
return GetFileLength(path_home) == -2;
return GetFileLength(path_home) == -EISDIR;
}
#pragma GCC visibility push(default)
@@ -284,7 +284,7 @@ int GetFileLength(const char *filename)
return 0;
if (S_ISDIR(statbuf.st_mode))
return -2; // a directory
return -EISDIR;
return statbuf.st_size;
}