Loading...
src/dyld.cpp dyld-43 dyld-43.1
--- dyld/dyld-43/src/dyld.cpp
+++ dyld/dyld-43.1/src/dyld.cpp
@@ -259,6 +259,15 @@
 		(*it)(image->machHeader(), image->getSlide());
 	}
 	
+	// tell all interested images
+	for (std::vector<ImageLoader*>::iterator it=sImagesToNotifyAboutOtherImages.begin(); it != sImagesToNotifyAboutOtherImages.end(); it++) {
+		dyld_image_info info;
+		info.imageLoadAddress = image->machHeader();
+		info.imageFilePath = image->getPath();
+		info.imageFileModDate = image->lastModified();
+		(*it)->doNotification(dyld_image_removing, 1, &info);
+	}
+
 	// remove from master list
 	for (std::vector<ImageLoader*>::iterator it=sAllImages.begin(); it != sAllImages.end(); it++) {
 		if ( *it == image ) {
@@ -503,8 +512,9 @@
 				sEnv.DYLD_ROOT_PATH = parseColonList(value);
 				for (int i=0; sEnv.DYLD_ROOT_PATH[i] != NULL; ++i) {
 					if ( sEnv.DYLD_ROOT_PATH[i][0] != '/' ) {
-						fprintf(stderr, "dyld: warning DYLD_ROOT_PATH not used because it contains a non-absolute path");
+						fprintf(stderr, "dyld: warning DYLD_ROOT_PATH not used because it contains a non-absolute path\n");
 						sEnv.DYLD_ROOT_PATH = NULL;
+						break;
 					}
 				}
 			}
@@ -653,7 +663,7 @@
 			if ( equals != NULL ) {
 				const char* value = &equals[1];
 				const int keyLen = equals-keyEqualsValue;
-				char key[keyLen];
+				char key[keyLen+1];
 				strncpy(key, keyEqualsValue, keyLen);
 				key[keyLen] = '\0';
 				processDyldEnvironmentVarible(key, value);
@@ -1860,20 +1870,16 @@
 _main(const struct mach_header* mainExecutableMH, int argc, const char* argv[], const char* envp[], const char* apple[])
 {	
 	// Pickup the pointer to the exec path.
-	const char* executable = apple[0];
-	if ( executable[0] == '/' ) {
-		// have full path, use it
-		sExecPath = executable;
-	}
-	else {
+	sExecPath = apple[0];
+	if ( sExecPath[0] != '/' ) {
 		// have relative path, use cwd to make absolute
 		char cwdbuff[MAXPATHLEN];
 	    if ( getcwd(cwdbuff, MAXPATHLEN) != NULL ) {
 			// maybe use static buffer to avoid calling malloc so early...
-			char* s = new char[strlen(cwdbuff) + strlen(executable) + 2];
+			char* s = new char[strlen(cwdbuff) + strlen(sExecPath) + 2];
 			strcpy(s, cwdbuff);
 			strcat(s, "/");
-			strcat(s, executable);
+			strcat(s, sExecPath);
 			sExecPath = s;
 		}
 	}