]> source.dussan.org Git - rspamd.git/commitdiff
Fix build on SunOS 129/head
authorSebastian Wiedenroth <wiedi@frubar.net>
Sun, 18 Jan 2015 01:30:28 +0000 (02:30 +0100)
committerSebastian Wiedenroth <wiedi@frubar.net>
Sun, 18 Jan 2015 01:30:28 +0000 (02:30 +0100)
- the struct dirent d_type is not available on SunOS
- tm_gmtoff is not a POSIX field

src/client/rspamc.c
src/lua/lua_task.c

index 2a3191f27bb8da64a5ef999ec60662c3d6fa0a24..5432aeae7d676f14d7f6c742cf16c4cbb58166f6 100644 (file)
@@ -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) {
index 6d2ded9ecd3d16ba8b450c69cbde8df48e20fa16..7eed0a3956a94c6211014401547d6474e3839f62 100644 (file)
@@ -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);
                        }