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

Side by Side Diff: base/posix/unix_domain_socket.cc

Issue 11118004: Fix a couple small problems in base/ (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 2 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 | « base/files/file_path_watcher_linux.cc ('k') | 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/posix/unix_domain_socket.h" 5 #include "base/posix/unix_domain_socket.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 #include <sys/uio.h> 9 #include <sys/uio.h>
10 #include <sys/socket.h> 10 #include <sys/socket.h>
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 ssize_t UnixDomainSocket::SendRecvMsg(int fd, 104 ssize_t UnixDomainSocket::SendRecvMsg(int fd,
105 uint8_t* reply, 105 uint8_t* reply,
106 unsigned max_reply_len, 106 unsigned max_reply_len,
107 int* result_fd, 107 int* result_fd,
108 const Pickle& request) { 108 const Pickle& request) {
109 int fds[2]; 109 int fds[2];
110 110
111 // This socketpair is only used for the IPC and is cleaned up before 111 // This socketpair is only used for the IPC and is cleaned up before
112 // returning. 112 // returning.
113 if (socketpair(AF_UNIX, SOCK_DGRAM, 0, fds) == -1) 113 if (socketpair(AF_UNIX, SOCK_DGRAM, 0, fds) == -1)
114 return false; 114 return -1;
115 115
116 std::vector<int> fd_vector; 116 std::vector<int> fd_vector;
117 fd_vector.push_back(fds[1]); 117 fd_vector.push_back(fds[1]);
118 if (!SendMsg(fd, request.data(), request.size(), fd_vector)) { 118 if (!SendMsg(fd, request.data(), request.size(), fd_vector)) {
119 close(fds[0]); 119 close(fds[0]);
120 close(fds[1]); 120 close(fds[1]);
121 return -1; 121 return -1;
122 } 122 }
123 close(fds[1]); 123 close(fds[1]);
124 124
(...skipping 12 matching lines...) Expand all
137 NOTREACHED(); 137 NOTREACHED();
138 138
139 return -1; 139 return -1;
140 } 140 }
141 141
142 if (result_fd) 142 if (result_fd)
143 *result_fd = fd_vector.empty() ? -1 : fd_vector[0]; 143 *result_fd = fd_vector.empty() ? -1 : fd_vector[0];
144 144
145 return reply_len; 145 return reply_len;
146 } 146 }
OLDNEW
« no previous file with comments | « base/files/file_path_watcher_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698