1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

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
This commit is contained in:
Kamil Dudka 2012-07-30 14:20:07 +02:00
parent a52857cb02
commit 1f8518c5d9

View File

@ -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) {