diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-01-21 16:11:04 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-01-21 16:11:04 -0800 |
commit | b03ef1199698f13dc9b349d5e94e2ff6c91ce012 (patch) | |
tree | a7fd8b4416df18b6ba95c32b142c7ae1ec54b2ef /toc.c | |
parent | 692b6a728e08ff4e936728b904d7b13bc4d301ed (diff) |
Simplify fallback code for systems without S_ISDIR
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'toc.c')
-rw-r--r-- | toc.c | 16 |
1 files changed, 4 insertions, 12 deletions
@@ -35,6 +35,10 @@ #include <sys/stat.h> +#ifndef S_ISDIR +#define S_ISDIR(mode) ((mode & S_IFMT) == S_IFDIR) +#endif + static int IsDir(char *name) { char str[500]; @@ -44,11 +48,7 @@ static int IsDir(char *name) if (snprintf(str, sizeof(str), "%s/%s", app_resources.mail_path, name) >= sizeof(str)) return False; if (stat(str, &buf) /* failed */) return False; -#ifdef S_ISDIR return S_ISDIR(buf.st_mode); -#else - return (buf.st_mode & S_IFMT) == S_IFDIR; -#endif } @@ -99,11 +99,7 @@ static void MakeSureSubfolderExists( if (stat(subfolder_path, &buf) /* failed */) Punt("Can't create new xmh subfolder!"); } -#ifdef S_ISDIR if (!S_ISDIR(buf.st_mode)) -#else - if ((buf.st_mode & S_IFMT) != S_IFDIR) -#endif punt: Punt("Can't create new xmh subfolder!"); } @@ -116,11 +112,7 @@ int TocFolderExists(Toc toc) app_resources.mail_path, toc->foldername); } return ((stat(toc->path, &buf) == 0) && -#ifdef S_ISDIR (S_ISDIR(buf.st_mode))); -#else - ((buf.st_mode & S_IFMT) == S_IFDIR)); -#endif } static void LoadCheckFiles(void) |