[Exim] Where is the bug?

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Joe Doehler
Datum:  
To: exim-users
Alte Treads: [Exim] antivirus.exim allow domain
Betreff: [Exim] Where is the bug?
This is a code snippet that is supposed to save some text in a file. The
code will become part of a larger "local_scan.c" routine. When built with
Exim's makefile, the routine writes the data into /local/filename twice:

<CodeSnippet>
#include "local_scan.h"
#include <stdio.h>
static int my_integer_option = 42;
static uschar *my_local_domain_option = US"a default string                  ";
optionlist local_scan_options[] = {
     { "my_integer", opt_int,       &my_integer_option },
     { "my_local_domain",  opt_stringptr, &my_local_domain_option }
      };
int local_scan_options_count = sizeof(local_scan_options)/sizeof(optionlist);


int local_scan(int fd, uschar **return_text)
{
FILE *fp;
     fp = fopen("/local/filename","a");
     fprintf (fp, "%s\n", "Some text");
     close(fp);
     return LOCAL_SCAN_ACCEPT;
}
</Code Snippet>


If I duplicate the code in a simple standalone executable, and the data
gets stored once, as I would expect:

<CodeSnippet>
#include <stdio.h>
int main(void)
{
FILE *fp;
     fp = fopen("/local/filename","a");
     fprintf (fp, "%s\n", "Some text");
     close(fp);
     return 0;
}
</CodeSnippet2>


Where is the bug? I am using Exim 4.21 with RedHat 9.

Joe.