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

Unified Diff: ports/nacl-spawn/nacl_spawn.cc

Issue 1742043002: Make M-x shell work in emacs. (Closed) Base URL: https://chromium.googlesource.com/webports.git@master
Patch Set: fix Created 4 years, 10 months 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
« ports/nacl-spawn/include/spawn.h ('K') | « ports/nacl-spawn/nacl_apipe.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ports/nacl-spawn/nacl_spawn.cc
diff --git a/ports/nacl-spawn/nacl_spawn.cc b/ports/nacl-spawn/nacl_spawn.cc
index 59cd9a955dc0b8af195414c7a093b9e8601cf245..77a99fe03c9ef77fb3804335a1ab58e9c1c16e2c 100644
--- a/ports/nacl-spawn/nacl_spawn.cc
+++ b/ports/nacl-spawn/nacl_spawn.cc
@@ -354,7 +354,8 @@ static int CloneFileDescriptors(struct PP_Var envs_var) {
char entry[100];
snprintf(entry, sizeof entry,
"NACL_SPAWN_FD_SETUP_%d=pipe:%d:%d:%d", count++, fd,
- static_cast<int>(st.st_ino), st.st_rdev == O_WRONLY);
+ static_cast<int>(st.st_ino),
+ (st.st_rdev & O_WRONLY) == O_WRONLY);
nspawn_array_appendstring(envs_var, entry);
} else if (S_ISLNK(st.st_mode)) {
// Unsupported.
@@ -689,6 +690,11 @@ void jseval(const char* cmd, char** data, size_t* len) {
// Create a javascript pipe. pipefd[0] will be the read end of the pipe
// and pipefd[1] the write end of the pipe.
int nacl_spawn_pipe(int pipefd[2]) {
+ return nacl_spawn_pipe_flags(0, pipefd);
+}
+
+// Same as above with flags.
+int nacl_spawn_pipe_flags(int flags, int pipefd[2]) {
if (pipefd == NULL) {
errno = EFAULT;
return -1;
@@ -705,8 +711,8 @@ int nacl_spawn_pipe(int pipefd[2]) {
int write_fd;
char path[100];
sprintf(path, "/apipe/%d", id);
- read_fd = open(path, O_RDONLY);
- write_fd = open(path, O_WRONLY);
+ read_fd = open(path, O_RDONLY | flags);
Pete Williamson 2016/02/29 20:53:47 What would happen here if flags had O_WRONLY set?
bradnelson 2016/03/03 18:04:03 Nothing good :-)
+ write_fd = open(path, O_WRONLY | flags);
if (read_fd < 0 || write_fd < 0) {
if (read_fd >= 0) {
close(read_fd);
« ports/nacl-spawn/include/spawn.h ('K') | « ports/nacl-spawn/nacl_apipe.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698