Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A bit of a refresher from the manpage of on <code>tmpfile()</code>, which returns a <code>FILE*</code>:</p> <blockquote>The file will be automatically deleted when it is closed or the program terminates.</blockquote> <p>My verdict for this issue: Deleting a file on Windows is weird.</p> <p>When you delete a file on Windows, for as long as something holds a handle, you can't call <code>CreateFile</code> on something with the same absolute path, otherwise it will fail with the NT error code <code>STATUS_DELETE_PENDING</code>, which gets mapped to the Win32 code <code>ERROR_ACCESS_DENIED</code>. This is probably where <code>EPERM</code> in <code>errno</code> is coming from. You can confirm this with a tool like Sysinternals Process Monitor.</p> <p>My guess is that CRT somehow wound up creating a file that has the same name as something it's used before. I've sometimes witnessed that deleting files on Windows can appear asynchronous because some other process (sometimes even an antivirus product, in reaction to the fact that you've just closed a delete-on-close handle...) will leave a handle open to the file, so for some timing window you will see a visible file that you can't get a handle to without hitting delete pending/access denied. Or, it could be that <code>tmpfile</code> has simply chosen a filename that some other process is working on.</p> <p>To avoid this sort of thing you might want to consider another mechanism for temp files... For example a function like Win32 <code>GetTempFileName</code> allows you to create your own prefix which might make a collision less likely. That function appears to resolve race conditions by retrying if a create fails with "already exists", so be careful about deleting the temp filenames that thing generates - deleting the file cancels your rights to use it concurrently with other processes/threads.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload