milters+mkstemp

From: Jerome M Berkman <jerry_at_uclink.berkeley.edu>
Date: Mon, 20 Aug 2001 21:40:32 -0700 (PDT)

I've been experimenting with the sample milter (mail filter), sample.c,
which comes with sendmail 8.11.4. It invokes mkstemp(). mkstemp() is
supplied an argument string which must end in 6 "X" characters which
are replaced by the unique file name. That would seem to allow for
many unique file names from each template.

However, I found that on our DU V4.0F sysem, the mkstemp(3) function
quits after creating only 32 files from the template. The man page has
no mention of a limit. I'm posting this to see if I'm missing
something basic, and, if not, to warn people about the problem.

        - Jerry Berkman, UC Berkeley


#include <stdio.h>

/* see how many files mkstemp() can make from one template */

main(){
        char vec[50];
        int fd;
        int i;
        FILE *stream;

        for( i = 1 ; i < 50; i++ ) {
                strcpy( vec, "abcXXXXXX" );
                fd = mkstemp( vec );
                printf( "i=%2d, name=%s\n", i, vec );
                if( fd < 0 ) {
                        printf( "*** mkstemp failed, fd = %d\n", fd );
                        exit(0);
                }
                stream = fdopen(fd, "w+");
                fprintf( stream, "hi\n" );
                fclose( stream );
                if( i % 8 == 0 ) sleep (1);
        }
}
Received on Tue Aug 21 2001 - 04:41:49 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:42 NZDT