{
//dyld::log("checkDylibOverridesInDir('%s')\n", dirPath);
char dylibPath[PATH_MAX];
- if ( strlcpy(dylibPath, dirPath, PATH_MAX) >= PATH_MAX )
+ int dirPathLen = strlcpy(dylibPath, dirPath, PATH_MAX-1);
+ if ( dirPathLen >= PATH_MAX )
return;
DIR* dirp = opendir(dirPath);
if ( dirp != NULL) {
break;
if ( entp->d_type != DT_REG )
continue;
- if ( strlcat(dylibPath, "/", PATH_MAX) >= PATH_MAX )
- continue;
+ dylibPath[dirPathLen] = '/';
+ dylibPath[dirPathLen+1] = '\0';
if ( strlcat(dylibPath, entp->d_name, PATH_MAX) >= PATH_MAX )
continue;
checkDylibOverride(dylibPath);
{
//dyld::log("checkFrameworkOverridesInDir('%s')\n", dirPath);
char frameworkPath[PATH_MAX];
- if ( strlcpy(frameworkPath, dirPath, PATH_MAX) >= PATH_MAX )
+ int dirPathLen = strlcpy(frameworkPath, dirPath, PATH_MAX-1);
+ if ( dirPathLen >= PATH_MAX )
return;
DIR* dirp = opendir(dirPath);
if ( dirp != NULL) {
break;
if ( entp->d_type != DT_DIR )
continue;
- if ( strlcat(frameworkPath, "/", PATH_MAX) >= PATH_MAX )
- continue;
- int dirNameLen = strlen(entp->d_name);
+ frameworkPath[dirPathLen] = '/';
+ frameworkPath[dirPathLen+1] = '\0';
+ int dirNameLen = (int)strlen(entp->d_name);
if ( dirNameLen < 11 )
continue;
if ( strcmp(&entp->d_name[dirNameLen-10], ".framework") != 0 )
export DYLD_VERSIONED_FRAMEWORK_PATH="${PWD}/alt11:${PWD}/alt12" && ./main 12
all:
- mkdir -p Foo.framework alt11/Foo.framework/Versions/A alt9/Foo.framework alt12/Foo.framework
+ mkdir -p Foo.framework alt11/Foo.framework/Versions/A alt9/Foo.framework alt12/Foo.framework Bar.framework alt11/Bar.framework/Versions/A/
+ ${CC} ${CCFLAGS} -dynamiclib bar.c -DRESULT=10 -current_version 10 -install_name "${PWD}/Bar.framework/Bar" -o Bar.framework/Bar
${CC} ${CCFLAGS} -dynamiclib foo.c -DRESULT=10 -current_version 10 -install_name "${PWD}/Foo.framework/Foo" -o Foo.framework/Foo
- ${CC} ${CCFLAGS} -I${TESTROOT}/include -o main main.c Foo.framework/Foo
+ ${CC} ${CCFLAGS} -I${TESTROOT}/include -o main main.c Bar.framework/Bar Foo.framework/Foo
${CC} ${CCFLAGS} -dynamiclib foo.c -DRESULT=11 -current_version 11 -install_name "${PWD}/Foo.framework/Foo" -o alt11/Foo.framework/Versions/A/Foo
+ ${CC} ${CCFLAGS} -dynamiclib bar.c -DRESULT=11 -current_version 11 -install_name "${PWD}/Bar.framework/Foo" -o alt11/Bar.framework/Versions/A/Bar
cd alt11/Foo.framework && ln -sf Versions/A/Foo
- ${CC} ${CCFLAGS} -dynamiclib foo.c -DRESULT=9 -current_version 9 -install_name "${PWD}/Foo.framework/Foo" -o alt9/Foo.framework/Foo
+ cd alt11/Bar.framework && ln -sf Versions/A/Bar
+ ${CC} ${CCFLAGS} -dynamiclib foo.c -DRESULT=9 -current_version 9 -install_name "${PWD}/Foo.framework/Foo" -o alt9/Foo.framework/Foo
${CC} ${CCFLAGS} -dynamiclib foo.c -DRESULT=12 -current_version 12 -install_name "${PWD}/Foo.framework/Foo" -o alt12/Foo.framework/Foo
clean:
- ${RM} -rf main Foo.framework alt9 alt11 alt12
+ ${RM} -rf main Foo.framework Bar.framework alt9 alt11 alt12
all:
mkdir -p alt11 alt9 alt12
${CC} ${CCFLAGS} -dynamiclib foo.c -DRESULT=10 -current_version 10 -o "${PWD}/libfoo.dylib"
- ${CC} ${CCFLAGS} -I${TESTROOT}/include -o main main.c libfoo.dylib
+ ${CC} ${CCFLAGS} -dynamiclib bar.c -DRESULT=10 -current_version 10 -o "${PWD}/libbar.dylib"
+ ${CC} ${CCFLAGS} -I${TESTROOT}/include -o main main.c libbar.dylib libfoo.dylib
${CC} ${CCFLAGS} -dynamiclib foo.c -DRESULT=11 -current_version 11 -install_name "${PWD}/libfoo.dylib" -o alt11/libfoo.dylib
- ${CC} ${CCFLAGS} -dynamiclib foo.c -DRESULT=9 -current_version 9 -install_name "${PWD}/libfoo.dylib" -o alt9/libfoo.dylib
+ ${CC} ${CCFLAGS} -dynamiclib bar.c -DRESULT=11 -current_version 11 -install_name "${PWD}/libbar.dylib" -o alt11/libbar.dylib
+ ${CC} ${CCFLAGS} -dynamiclib foo.c -DRESULT=9 -current_version 9 -install_name "${PWD}/libfoo.dylib" -o alt9/libfoo.dylib
${CC} ${CCFLAGS} -dynamiclib foo.c -DRESULT=12 -current_version 12 -install_name "${PWD}/libfoo.dylib" -o alt12/libfoo.dylib
clean:
- ${RM} -rf main libfoo.dylib alt9 alt11 alt12
+ ${RM} -rf main libfoo.dylib libbar.dylib alt9 alt11 alt12