Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / base / android / fifo_utils.cc
blob8f3e95f92db599b4c5cf7894adbfb81ba5877f6b
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/android/fifo_utils.h"
7 #include <sys/stat.h>
9 #include "base/files/file_path.h"
11 namespace base {
12 namespace android {
14 bool CreateFIFO(const FilePath& path, int mode) {
15 // Default permissions for mkfifo() is ignored, chmod() is required.
16 return mkfifo(path.value().c_str(), mode) == 0 &&
17 chmod(path.value().c_str(), mode) == 0;
20 bool RedirectStream(FILE* stream, const FilePath& path, const char* mode) {
21 return freopen(path.value().c_str(), mode, stream) != NULL;
24 } // namespace android
25 } // namespace base