On Thu, 26 Jan 2006, Eugene Filatov wrote:
> > Does that patch actually help?
> Will write later about results.
Yes, it's worked.
I found some bugs in output to syslog in previous patch, corrected version
is below. Also I increased usleep time.
My friend which which knows C told me that "usleep" is thread unsafe and
it's better to use something like "nanosleep". I tried "nanosleep" but
something wrong happened with milte-greylist (it crashed every two
minutes).
What about using "open, malloc+snprintf+write+free" in milter-greylist?
It should be the best solution.
Best Regards, mailto:eugenef@...
Eugene.
*** dump.c.orig Thu Jan 26 09:36:32 2006
--- dump.c Thu Jan 26 16:48:54 2006
***************
*** 196,201 ****
--- 196,232 ----
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, "new FD is %d (>254). duplicating it again (%d tries remain).",
+ lowfd, retries);
+ }
+
+ if (retries-- == 0) {
+ /* Handle error gracefully */
+ syslog(LOG_ERR, "cannot get FD lower than 255. sad but true.");
+ exit(EX_OSERR);
+ }
+
+ (void) usleep (1000000);
+ }
+ }
+
if ((dump = fdopen(dumpfd, "w")) == NULL) {
syslog(LOG_ERR, "cannot write dumpfile \"%s\": %s",
newdumpfile, strerror(errno));Message
Re: [milter-greylist] milter-greylist-2.0.2 crash
2006-01-26 by Eugene Filatov
Attachments
- No local attachments were found for this message.