Commits

Ronald Oussoren committed 1402978

fix objc.inject in the 2.x branch as well (forward port of revision 1926)

  • Participants
  • Parent commits ff5aa68
  • Branches pyobjc2

Comments (0)

Files changed (2)

File pyobjc-core/Modules/objc/mach_inject.m

 				
 				// needed for Universal binaries. Check if file is fat and get image size from there.
 				int fd = open (imageName, O_RDONLY);
+				if (fd == -1) {
+					return unix_err (errno );
+				}
 				size_t mapSize = *size;
-				char * fileImage = mmap (NULL, mapSize, PROT_READ, MAP_FILE, fd, 0);
+				char * fileImage = mmap (NULL, mapSize, PROT_READ, MAP_FILE|MAP_PRIVATE, fd, 0);
+				if (fileImage == (char*)-1) {
+					return unix_err (errno );
+				}
 				
 				struct fat_header* fatHeader = (struct fat_header *)fileImage;
 				if (fatHeader->magic == OSSwapBigToHostInt32(FAT_MAGIC)) {

File pyobjc-core/NEWS.txt

 Version 2.0.1 (...)
 -------------------
 
+- BUGFIX: ``objc.inject`` works on Leopard (at least on Intel Macs, haven't
+  tested on PPC). 
+
 - BUGFIX: don't crash when printing CF objects that are magic cookies.
 
 - BUGFIX: It is now possible to override ``respondsToSelector:`` in Python.