system/FileDescriptor: pass FileDescriptor to CheckDuplicate()
This commit is contained in:
		| @@ -205,9 +205,9 @@ FileDescriptor::DisableCloseOnExec() noexcept | |||||||
| } | } | ||||||
|  |  | ||||||
| bool | bool | ||||||
| FileDescriptor::CheckDuplicate(int new_fd) noexcept | FileDescriptor::CheckDuplicate(FileDescriptor new_fd) noexcept | ||||||
| { | { | ||||||
| 	if (fd == new_fd) { | 	if (*this == new_fd) { | ||||||
| 		DisableCloseOnExec(); | 		DisableCloseOnExec(); | ||||||
| 		return true; | 		return true; | ||||||
| 	} else | 	} else | ||||||
|   | |||||||
| @@ -168,8 +168,8 @@ public: | |||||||
| 	/** | 	/** | ||||||
| 	 * Duplicate the file descriptor onto the given file descriptor. | 	 * Duplicate the file descriptor onto the given file descriptor. | ||||||
| 	 */ | 	 */ | ||||||
| 	bool Duplicate(int new_fd) const noexcept { | 	bool Duplicate(FileDescriptor new_fd) const noexcept { | ||||||
| 		return ::dup2(Get(), new_fd) == 0; | 		return ::dup2(Get(), new_fd.Get()) == 0; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -178,7 +178,7 @@ public: | |||||||
| 	 * this method to inject file descriptors into a new child | 	 * this method to inject file descriptors into a new child | ||||||
| 	 * process, to be used by a newly executed program. | 	 * process, to be used by a newly executed program. | ||||||
| 	 */ | 	 */ | ||||||
| 	bool CheckDuplicate(int new_fd) noexcept; | 	bool CheckDuplicate(FileDescriptor new_fd) noexcept; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef __linux__ | #ifdef __linux__ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Max Kellermann
					Max Kellermann