diff options
author | Sebastian Wiedenroth <wiedi@frubar.net> | 2015-01-18 02:30:28 +0100 |
---|---|---|
committer | Sebastian Wiedenroth <wiedi@frubar.net> | 2015-01-18 02:30:28 +0100 |
commit | 9c9527faa922fff90f04a7c22788a282b4b02fa1 (patch) | |
tree | 8c901123c0921b9dd658ae969ce439157e24eb22 | |
parent | 146debb5020659b4cbfdced4ca6d651de162dd4b (diff) | |
download | rspamd-9c9527faa922fff90f04a7c22788a282b4b02fa1.tar.gz rspamd-9c9527faa922fff90f04a7c22788a282b4b02fa1.zip |
Fix build on SunOS
- the struct dirent d_type is not available on SunOS
- tm_gmtoff is not a POSIX field
-rw-r--r-- | src/client/rspamc.c | 12 | ||||
-rw-r--r-- | src/lua/lua_task.c | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/client/rspamc.c b/src/client/rspamc.c index 2a3191f27..5432aeae7 100644 --- a/src/client/rspamc.c +++ b/src/client/rspamc.c @@ -853,6 +853,9 @@ rspamc_process_dir (struct event_base *ev_base, struct rspamc_command *cmd, DIR *d; gint cur_req = 0; struct dirent *ent; +#if defined(__sun) + struct stat sb; +#endif FILE *in; char filebuf[PATH_MAX]; @@ -860,9 +863,14 @@ rspamc_process_dir (struct event_base *ev_base, struct rspamc_command *cmd, if (d != NULL) { while ((ent = readdir (d))) { + rspamd_snprintf (filebuf, sizeof (filebuf), "%s%c%s", + name, G_DIR_SEPARATOR, ent->d_name); +#if defined(__sun) + if (stat (filebuf, &sb)) continue; + if (S_ISREG (sb.st_mode)) { +#else if (ent->d_type == DT_REG || ent->d_type == DT_UNKNOWN) { - rspamd_snprintf (filebuf, sizeof (filebuf), "%s%c%s", - name, G_DIR_SEPARATOR, ent->d_name); +#endif if (access (filebuf, R_OK) != -1) { in = fopen (filebuf, "r"); if (in == NULL) { diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 6d2ded9ec..7eed0a395 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -1763,7 +1763,9 @@ lua_task_get_date (lua_State *L) tt = tim; localtime_r (&tt, &t); +#if !defined(__sun) t.tm_gmtoff = 0; +#endif t.tm_isdst = 0; tim = mktime (&t); } |