Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Message

Re: [milter-greylist] milter-greylist-2.0.2 crash

2006-01-26 by Eugene Filatov

On Wed, 25 Jan 2006 manu@... wrote:

> > Crude untested hack:
> That looks painful :-)
> Eugene, can you finish and test Matthias' hack? If it works, I'll
> integrate it.

Yes.

I modified it a little with help of my friend which knows Solaris and
C much better than me :-) My friend told me that FD equal to 255 is also
not acceptible on Solaris and he added "close" funnction to duplicated FD
which is not acceptible.

Here is the difference:

/opt/tmp/milter-greylist-2.1.2# diff -c dump.c.orig dump.c
*** dump.c.orig Thu Jan 26 09:36:32 2006
--- dump.c      Thu Jan 26 10:11:26 2006
***************
*** 196,201 ****
--- 196,233 ----
                exit(EX_OSERR);
        }

+ /* SOLARIS_FD_WORKARROUND */
+         if (dumpfd > 255) {
+                 int     retries = 10;
+
+                 while (dumpfd > 254) {
+                         int     lowfd;
+                       syslog(LOG_ERR, "current FD is %d (>254). we're duplicating it.",
+                           dumpfd);
+                         lowfd = dup(dumpfd);
+                         if (lowfd <= 254) {
+                                 (void)close(dumpfd);
+                                 dumpfd = lowfd;
+                               syslog(LOG_ERR, "new FD is %d. now we can write dump file.",
+                                  dumpfd);
+                                 break;
+                         } else {
+                             (void)close(lowfd);
+                             syslog(LOG_ERR, "current FD is %d (>254). duplicating it again.",
+                                dumpfd);
+                         }
+
+                         if (retries-- == 0) {
+                                /* Handle error gracefully */
+                                syslog(LOG_ERR, "cannot get FD lower than 255. sad but true.");
+                                exit(EX_OSERR);
+                         }
+
+                         (void) usleep(10);
+                 }
+         }
+
+
        if ((dump = fdopen(dumpfd, "w")) == NULL) {
                syslog(LOG_ERR, "cannot write dumpfile \"%s\": %s",
                    newdumpfile, strerror(errno));

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.