From b2c93cc12cec881066556a0b3245acf4273f5f34 Mon Sep 17 00:00:00 2001 From: Jessica Hamilton Date: Fri, 20 Jun 2014 04:57:11 +0000 Subject: sendmsg.c: fix compiling with gcc2. diff --git a/src/twisted/python/_sendmsg.c b/src/twisted/python/_sendmsg.c index e84c08b..e9b8677 100644 --- a/src/twisted/python/_sendmsg.c +++ b/src/twisted/python/_sendmsg.c @@ -175,9 +175,11 @@ static PyObject *sendmsg_sendmsg(PyObject *self, PyObject *args, PyObject *keywd int fd; int flags = 0; + size_t all_data_len = 0; Py_ssize_t sendmsg_result, iovec_length; struct msghdr message_header; - struct iovec iov[1]; + struct iovec iov[1]; + struct cmsghdr *control_message = NULL; PyObject *ancillary = NULL; PyObject *iterator = NULL; PyObject *item = NULL; @@ -223,7 +225,7 @@ static PyObject *sendmsg_sendmsg(PyObject *self, PyObject *args, PyObject *keywd goto finished; } - size_t all_data_len = 0; + all_data_len = 0; /* First we need to know how big the buffer needs to be in order to have enough space for all of the messages. */ @@ -298,7 +300,7 @@ static PyObject *sendmsg_sendmsg(PyObject *self, PyObject *args, PyObject *keywd } /* Unpack the tuples into the control message. */ - struct cmsghdr *control_message = CMSG_FIRSTHDR(&message_header); + control_message = CMSG_FIRSTHDR(&message_header); while ( (item = PyIter_Next(iterator)) && control_message!=NULL ) { int type, level; Py_ssize_t data_len; @@ -505,12 +507,13 @@ static PyObject *sendmsg_recvmsg(PyObject *self, PyObject *args, PyObject *keywd static PyObject *sendmsg_getsockfam(PyObject *self, PyObject *args, PyObject *keywds) { int fd; + socklen_t sz; struct sockaddr sa; static char *kwlist[] = {"fd", NULL}; if (!PyArg_ParseTupleAndKeywords(args, keywds, "i", kwlist, &fd)) { return NULL; } - socklen_t sz = sizeof(sa); + sz = sizeof(sa); if (getsockname(fd, &sa, &sz)) { PyErr_SetFromErrno(sendmsg_socket_error); return NULL; -- 2.11.0