On Sep 21, John Edwards said:
>do {
> $artikelID = &newID;
>} until (! -e $ARTIKEL_DIR.$artikelID);
That produces a race condition. Between the checking for the existence of
the file, and the opening of the file itself, the file COULD be created.
I suggest the use of the sysopen() function.
king for existence of a file.
I have a subroutine &newID that constructs a pseudo-random ID on every
invocation. Regularly, a file needs to be created in a directory, say
$ARTIKEL_DIR, using a newly generated ID. Of course, I want to make sure
that the file (the ID) doesn't exist yet.
I have a subroutine &newID that constructs a pseudo-random ID on every
invocation. Regularly, a file needs to be created in a directory, say
$ARTIKEL_DIR, using a newly generated ID. Of course, I want to make sure
that the file (the ID) doesn't exist yet. Of course, I could put all IDs
previou