tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: Jerome M Berkman <jerry () uclink ! berkeley ! edu>
To: tru64-unix-managers
Subject: milters+mkstemp
Date: Tue, 21 Aug 2001 04:40:32 +0000	[thread overview]
Message-ID: <102653669621996.tru64-unix-managers.marc@archive.invalid> (raw)

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);
	}
}

                 reply	other threads:[~2001-08-21  4:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox