]> granicus.if.org Git - python/commitdiff
Windows mmap should (as the docs probably <wink> say) create a mapping
authorTim Peters <tim.peters@gmail.com>
Wed, 10 Jan 2001 05:42:18 +0000 (05:42 +0000)
committerTim Peters <tim.peters@gmail.com>
Wed, 10 Jan 2001 05:42:18 +0000 (05:42 +0000)
without a name when the optional tagname arg isn't specified.  Was
actually creating a mapping with an empty string as the name.

Modules/mmapmodule.c

index b245c895d6e5611967f236794fda6a7735ff40a3..332b2dab55297f8dea3cd8db24ff80a73982dffe 100644 (file)
@@ -907,7 +907,7 @@ new_mmap_object(PyObject *self, PyObject *args)
        m_obj->pos = (size_t) 0;
 
        /* set the tag name */
-       if (tagname != NULL) {
+       if (tagname != NULL && *tagname != '\0') {
                m_obj->tagname = PyMem_Malloc(strlen(tagname)+1);
                if (m_obj->tagname == NULL) {
                        PyErr_NoMemory();
@@ -924,7 +924,7 @@ new_mmap_object(PyObject *self, PyObject *args)
                                               PAGE_READWRITE,
                                               0,
                                               m_obj->size,
-                                              tagname);
+                                              m_obj->tagname);
        if (m_obj->map_handle != NULL) {
                m_obj->data = (char *) MapViewOfFile (m_obj->map_handle,
                                                      FILE_MAP_WRITE,