mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-12-23 09:18:55 +00:00
parent
30353f1a83
commit
aec7efc3af
@ -3304,8 +3304,13 @@ int S3fsCurl::PutRequest(const char* tpath, headers_t& meta, int fd)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if(-1 != fd){
|
if(-1 != fd){
|
||||||
// TODO: is this necessary?
|
|
||||||
// duplicate fd
|
// duplicate fd
|
||||||
|
//
|
||||||
|
// [NOTE]
|
||||||
|
// This process requires FILE*, then it is linked to fd with fdopen.
|
||||||
|
// After processing, the FILE* is closed with fclose, and fd is closed together.
|
||||||
|
// The fd should not be closed here, so call dup here to duplicate it.
|
||||||
|
//
|
||||||
int fd2;
|
int fd2;
|
||||||
if(-1 == (fd2 = dup(fd)) || -1 == fstat(fd2, &st) || 0 != lseek(fd2, 0, SEEK_SET) || NULL == (file = fdopen(fd2, "rb"))){
|
if(-1 == (fd2 = dup(fd)) || -1 == fstat(fd2, &st) || 0 != lseek(fd2, 0, SEEK_SET) || NULL == (file = fdopen(fd2, "rb"))){
|
||||||
S3FS_PRN_ERR("Could not duplicate file descriptor(errno=%d)", errno);
|
S3FS_PRN_ERR("Could not duplicate file descriptor(errno=%d)", errno);
|
||||||
|
Loading…
Reference in New Issue
Block a user