| Index: base/files/file_posix.cc
|
| diff --git a/base/files/file_posix.cc b/base/files/file_posix.cc
|
| index 663f099f11fa9c7a5770e1ba488793246cef7dd9..517390f8eacf71135f9e62aff00de4a2d2b7f337 100644
|
| --- a/base/files/file_posix.cc
|
| +++ b/base/files/file_posix.cc
|
| @@ -463,6 +463,20 @@ File::Error File::Unlock() {
|
| return CallFctnlFlock(file_.get(), false);
|
| }
|
|
|
| +File File::Duplicate() {
|
| + if (!IsValid())
|
| + return File();
|
| +
|
| + PlatformFile other_fd = dup(GetPlatformFile());
|
| + if (other_fd == -1)
|
| + return File(OSErrorToFileError(errno));
|
| +
|
| + File other(other_fd);
|
| + if (async())
|
| + other.async_ = true;
|
| + return other.Pass();
|
| +}
|
| +
|
| // Static.
|
| File::Error File::OSErrorToFileError(int saved_errno) {
|
| switch (saved_errno) {
|
|
|