Skip to content

Commit

Permalink
Fix compilation warnings for dlsym() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
vslavik committed Sep 8, 2022
1 parent e60633c commit 8714292
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions PFMoveApplication.m
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,13 @@ void PFMoveToApplicationsFolderIfNecessary(void) {

// Get (undocumented?) function symbols for looking up app translocation info
// Note: <Security/SecTranslocation.h> was available in the macOS 10.12 beta SDKs but seems to have been removed as of Xcode 8.1
Boolean(*mySecTranslocateIsTranslocatedURL)(CFURLRef path, bool *isTranslocated, CFErrorRef * __nullable error) = dlsym(handle, "SecTranslocateIsTranslocatedURL");
CFURLRef __nullable(*mySecTranslocateCreateOriginalPathForURL)(CFURLRef translocatedPath, CFErrorRef * __nullable error) = dlsym(handle, "SecTranslocateCreateOriginalPathForURL");
// see https://opensource.apple.com/source/Security/Security-58286.70.7/OSX/libsecurity_translocate/lib/SecTranslocate.h.auto.html

typedef Boolean (*SecTranslocateIsTranslocatedURL_t)(CFURLRef path, bool *isTranslocated, CFErrorRef * __nullable error);
SecTranslocateIsTranslocatedURL_t mySecTranslocateIsTranslocatedURL = (SecTranslocateIsTranslocatedURL_t)dlsym(handle, "SecTranslocateIsTranslocatedURL");

typedef CFURLRef __nullable(*SecTranslocateCreateOriginalPathForURL_t)(CFURLRef translocatedPath, CFErrorRef * __nullable error);
SecTranslocateCreateOriginalPathForURL_t mySecTranslocateCreateOriginalPathForURL = (SecTranslocateCreateOriginalPathForURL_t)dlsym(handle, "SecTranslocateCreateOriginalPathForURL");

dlclose(handle);

Expand Down

0 comments on commit 8714292

Please sign in to comment.