Skip to content

Commit

Permalink
file: use fdopen() for uploaded files if available
Browse files Browse the repository at this point in the history
It eliminates noisy events when using inotify and fixes a TOCTOU issue.

Bug: https://bugzilla.redhat.com/844385
  • Loading branch information
kdudka committed Jul 30, 2012
1 parent a52857c commit 1f8518c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,12 @@ static CURLcode file_upload(struct connectdata *conn)
failf(data, "Can't open %s for writing", file->path);
return CURLE_WRITE_ERROR;
}
#ifdef HAVE_FDOPEN
fp = fdopen(fd, "wb");
#else
close(fd);
fp = fopen(file->path, "wb");
#endif
}

if(!fp) {
Expand Down

0 comments on commit 1f8518c

Please sign in to comment.