[CalendarServer-changes] [7850] CalendarServer/trunk/twext/python/sendmsg.c

source_changes at macosforge.org source_changes at macosforge.org
Mon Aug 1 16:43:37 PDT 2011


Revision: 7850
          http://trac.macosforge.org/projects/calendarserver/changeset/7850
Author:   glyph at apple.com
Date:     2011-08-01 16:43:35 -0700 (Mon, 01 Aug 2011)
Log Message:
-----------
assert about the control message before it's about to be used, not after it's just been advanced.  it's valid to return NULL after the last iteration.

Modified Paths:
--------------
    CalendarServer/trunk/twext/python/sendmsg.c

Modified: CalendarServer/trunk/twext/python/sendmsg.c
===================================================================
--- CalendarServer/trunk/twext/python/sendmsg.c	2011-08-01 23:16:18 UTC (rev 7849)
+++ CalendarServer/trunk/twext/python/sendmsg.c	2011-08-01 23:43:35 UTC (rev 7850)
@@ -185,6 +185,10 @@
             int data_len, type, level;
             unsigned char *data, *cmsg_data;
 
+            /* We explicitly allocated enough space for all ancillary data
+               above; if there isn't enough room, all bets are off. */
+            assert(control_message);
+
             if (!PyArg_ParseTuple(item,
                                   "iit#:sendmsg ancillary data (level, type, data)",
                                   &level,
@@ -207,10 +211,6 @@
             Py_DECREF(item);
 
             control_message = CMSG_NXTHDR(&message_header, control_message);
-
-            /* We explicitly allocated enough space for all ancillary data
-               above; if there isn't enough room, all bets are off. */
-            assert(control_message);
         }
         
         Py_DECREF(iterator);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110801/7250ad89/attachment.html>


More information about the calendarserver-changes mailing list