@@ -157,7 +157,7 @@ main(int argc, char *argv[])
157157if (rc != 0 )
158158{
159159fprintf (stderr ,"Failed to create thread 1: %s **\nexiting\n" ,
160- strerror (rc ));
160+ strerror (errno ));
161161exit (1 );
162162}
163163rc = pthread_create (& thread2 ,NULL , (void * (* ) (void * ))func_call_2 ,NULL );
@@ -285,6 +285,11 @@ func_call_1(void)
285285/* Set errno = EEXIST */
286286
287287/* create, then try to fail on exclusive create open */
288+ /*
289+ * It would be great to check errno here but if errno is not thread-safe
290+ * we might get a value from the other thread and mis-report the cause
291+ * of the failure.
292+ */
288293#ifdef WIN32
289294if ((h1 = CreateFile (TEMP_FILENAME_1 ,GENERIC_WRITE ,0 ,NULL ,OPEN_ALWAYS ,0 ,NULL ))==
290295INVALID_HANDLE_VALUE )
@@ -299,7 +304,7 @@ func_call_1(void)
299304
300305#ifdef WIN32
301306if (CreateFile (TEMP_FILENAME_1 ,GENERIC_WRITE ,0 ,NULL ,CREATE_NEW ,0 ,NULL )
302- != INVALID_HANDLE_VALUE || GetLastError () != ERROR_FILE_EXISTS )
307+ != INVALID_HANDLE_VALUE )
303308#else
304309if (open (TEMP_FILENAME_1 ,O_RDWR |O_CREAT |O_EXCL ,0600 ) >=0 )
305310#endif