mirror of
https://github.com/curl/curl.git
synced 2025-01-30 14:22:33 +08: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:
parent
a52857cb02
commit
1f8518c5d9
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user