Commit 2de8926f authored by agl@chromium.org's avatar agl@chromium.org

Add a forgotton const qualifier to SendMsg.

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53978 0039d316-1c4b-4281-b951-d872f2087c98
parent 17773047
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
namespace base { namespace base {
bool SendMsg(int fd, const void* buf, size_t length, std::vector<int>& fds) { bool SendMsg(int fd, const void* buf, size_t length,
const std::vector<int>& fds) {
struct msghdr msg; struct msghdr msg;
memset(&msg, 0, sizeof(msg)); memset(&msg, 0, sizeof(msg));
struct iovec iov = {const_cast<void*>(buf), length}; struct iovec iov = {const_cast<void*>(buf), length};
...@@ -26,11 +27,8 @@ bool SendMsg(int fd, const void* buf, size_t length, std::vector<int>& fds) { ...@@ -26,11 +27,8 @@ bool SendMsg(int fd, const void* buf, size_t length, std::vector<int>& fds) {
if (fds.size()) { if (fds.size()) {
const unsigned control_len = CMSG_SPACE(sizeof(int) * fds.size()); const unsigned control_len = CMSG_SPACE(sizeof(int) * fds.size());
control_buffer = new char[control_len]; control_buffer = new char[control_len];
if (!control_buffer)
return false;
struct cmsghdr *cmsg; struct cmsghdr *cmsg;
msg.msg_control = control_buffer; msg.msg_control = control_buffer;
msg.msg_controllen = control_len; msg.msg_controllen = control_len;
cmsg = CMSG_FIRSTHDR(&msg); cmsg = CMSG_FIRSTHDR(&msg);
......
...@@ -17,7 +17,7 @@ namespace base { ...@@ -17,7 +17,7 @@ namespace base {
// Use sendmsg to write the given msg and include a vector // Use sendmsg to write the given msg and include a vector
// of file descriptors. Returns true iff successful. // of file descriptors. Returns true iff successful.
bool SendMsg(int fd, const void* msg, size_t length, bool SendMsg(int fd, const void* msg, size_t length,
std::vector<int>& fds); const std::vector<int>& fds);
// Use recvmsg to read a message and an array of file descriptors. Returns // Use recvmsg to read a message and an array of file descriptors. Returns
// -1 on failure. Note: will read, at most, 16 descriptors. // -1 on failure. Note: will read, at most, 16 descriptors.
ssize_t RecvMsg(int fd, void* msg, size_t length, std::vector<int>* fds); ssize_t RecvMsg(int fd, void* msg, size_t length, std::vector<int>* fds);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment