Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2767)

Unified Diff: remoting/host/linux/audio_pipe_reader.cc

Issue 820123002: Use O_NONBLOCK when opening audio pipe on linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/linux/audio_pipe_reader.cc
diff --git a/remoting/host/linux/audio_pipe_reader.cc b/remoting/host/linux/audio_pipe_reader.cc
index 76be36c2ae4d361bfa7d0aaff63e770be73ad11f..8e9bbab341a9ab28e9b80f46d0152f6a180de23d 100644
--- a/remoting/host/linux/audio_pipe_reader.cc
+++ b/remoting/host/linux/audio_pipe_reader.cc
@@ -107,10 +107,8 @@ void AudioPipeReader::OnDirectoryChanged(const base::FilePath& path,
void AudioPipeReader::TryOpenPipe() {
DCHECK(task_runner_->BelongsToCurrentThread());
- base::File new_pipe;
- new_pipe.Initialize(
- pipe_path_,
- base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_ASYNC);
+ base::File new_pipe(
+ HANDLE_EINTR(open(pipe_path_.value().c_str(), O_RDONLY | O_NONBLOCK)));
// If both |pipe_| and |new_pipe| are valid then compare inodes for the two
// file descriptors. Don't need to do anything if inode hasn't changed.
@@ -130,13 +128,6 @@ void AudioPipeReader::TryOpenPipe() {
pipe_ = new_pipe.Pass();
if (pipe_.IsValid()) {
- // Set O_NONBLOCK flag.
- if (HANDLE_EINTR(fcntl(pipe_.GetPlatformFile(), F_SETFL, O_NONBLOCK)) < 0) {
- PLOG(ERROR) << "fcntl";
- pipe_.Close();
- return;
- }
-
// Set buffer size for the pipe.
if (HANDLE_EINTR(fcntl(
pipe_.GetPlatformFile(), F_SETPIPE_SZ, kPipeBufferSizeBytes)) < 0) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698