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

Side by Side Diff: src/d8-posix.cc

Issue 115698: Do not ignore the result from calls to write(). This avoids a warning... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 close(exec_error_fds[kReadFD]); // Don't need this in the child. 273 close(exec_error_fds[kReadFD]); // Don't need this in the child.
274 close(stdout_fds[kReadFD]); // Don't need this in the child. 274 close(stdout_fds[kReadFD]); // Don't need this in the child.
275 close(1); // Close stdout. 275 close(1); // Close stdout.
276 dup2(stdout_fds[kWriteFD], 1); // Dup pipe fd to stdout. 276 dup2(stdout_fds[kWriteFD], 1); // Dup pipe fd to stdout.
277 close(stdout_fds[kWriteFD]); // Don't need the original fd now. 277 close(stdout_fds[kWriteFD]); // Don't need the original fd now.
278 fcntl(exec_error_fds[kWriteFD], F_SETFD, FD_CLOEXEC); 278 fcntl(exec_error_fds[kWriteFD], F_SETFD, FD_CLOEXEC);
279 execvp(exec_args.arg0(), exec_args.arg_array()); 279 execvp(exec_args.arg0(), exec_args.arg_array());
280 // Only get here if the exec failed. Write errno to the parent to tell 280 // Only get here if the exec failed. Write errno to the parent to tell
281 // them it went wrong. If it went well the pipe is closed. 281 // them it went wrong. If it went well the pipe is closed.
282 int err = errno; 282 int err = errno;
283 write(exec_error_fds[kWriteFD], &err, sizeof(err)); 283 int bytes_written;
284 do {
285 bytes_written = write(exec_error_fds[kWriteFD], &err, sizeof(err));
286 } while (bytes_written == -1 && errno == EINTR);
284 // Return (and exit child process). 287 // Return (and exit child process).
285 } 288 }
286 289
287 290
288 // Runs in the parent process. Checks that the child was able to exec (closing 291 // Runs in the parent process. Checks that the child was able to exec (closing
289 // the file desriptor), or reports an error if it failed. 292 // the file desriptor), or reports an error if it failed.
290 static bool ChildLaunchedOK(int* exec_error_fds) { 293 static bool ChildLaunchedOK(int* exec_error_fds) {
291 int bytes_read; 294 int bytes_read;
292 int err; 295 int err;
293 do { 296 do {
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 void Shell::AddOSMethods(Handle<ObjectTemplate> os_templ) { 662 void Shell::AddOSMethods(Handle<ObjectTemplate> os_templ) {
660 os_templ->Set(String::New("system"), FunctionTemplate::New(System)); 663 os_templ->Set(String::New("system"), FunctionTemplate::New(System));
661 os_templ->Set(String::New("chdir"), FunctionTemplate::New(ChangeDirectory)); 664 os_templ->Set(String::New("chdir"), FunctionTemplate::New(ChangeDirectory));
662 os_templ->Set(String::New("setenv"), FunctionTemplate::New(SetEnvironment)); 665 os_templ->Set(String::New("setenv"), FunctionTemplate::New(SetEnvironment));
663 os_templ->Set(String::New("umask"), FunctionTemplate::New(SetUMask)); 666 os_templ->Set(String::New("umask"), FunctionTemplate::New(SetUMask));
664 os_templ->Set(String::New("mkdirp"), FunctionTemplate::New(MakeDirectory)); 667 os_templ->Set(String::New("mkdirp"), FunctionTemplate::New(MakeDirectory));
665 os_templ->Set(String::New("rmdir"), FunctionTemplate::New(RemoveDirectory)); 668 os_templ->Set(String::New("rmdir"), FunctionTemplate::New(RemoveDirectory));
666 } 669 }
667 670
668 } // namespace v8 671 } // namespace v8
OLDNEW
« 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