The realpath(3) will fail if the target does not exist (internally
realpath will stat all the components of the link target path).
This is a problem in the case of sandbox applications where
the exe points to the absolute path *inside* the sandbox, e.g. to
/app/bin/<name> in the case of flatpak. For these cases realpath(3)
will then fail. Therefore use readlink(3) instead.