Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

file: use fdopen() for uploaded files if available

It eliminates noisy events when using inotify and fixes a TOCTOU issue.

Bug: https://bugzilla.redhat.com/844385
  • Loading branch information...
commit 1f8518c5d9aaa369dae85620973f9b5c1add3277 1 parent a52857c
Kamil Dudka authored July 30, 2012

Showing 1 changed file with 4 additions and 0 deletions. Show diff stats Hide diff stats

  1. 4  lib/file.c
4  lib/file.c
@@ -351,8 +351,12 @@ static CURLcode file_upload(struct connectdata *conn)
351 351
       failf(data, "Can't open %s for writing", file->path);
352 352
       return CURLE_WRITE_ERROR;
353 353
     }
  354
+#ifdef HAVE_FDOPEN
  355
+    fp = fdopen(fd, "wb");
  356
+#else
354 357
     close(fd);
355 358
     fp = fopen(file->path, "wb");
  359
+#endif
356 360
   }
357 361
 
358 362
   if(!fp) {

0 notes on commit 1f8518c

Please sign in to comment.
Something went wrong with that request. Please try again.