This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

bug in mkstemp


In this program, the second call to mkstemp will fail:

#include <stdio.h>
#include <sys/param.h>

main()
{
  char path[MAXPATHLEN];
        int fd, rc;

        sprintf(path, "/tmp/test.XXXXXX");
        fd = mkstemp(path);
        if (fd < 0) { perror("mkstemp 1"); exit(1); }
        rc = unlink(path);
        if (rc < 0) { perror("unlink"); exit(1); }
        sprintf(path, "/tmp/test.XXXXXX");
        fd = mkstemp(path);
        if (fd < 0) { perror("mkstemp 2"); exit(1); }
        rc = unlink(path);
        if (rc < 0) { perror("unlink"); exit(1); }

        exit(0);
}

The fix should be simply to treat EACCES just like EEXIST in mkstemp.

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]