diff --git a/libbpf_android/Loader.cpp b/libbpf_android/Loader.cpp index 0e9d005..15a3950 100644 --- a/libbpf_android/Loader.cpp +++ b/libbpf_android/Loader.cpp @@ -30,9 +30,9 @@ #include #include -// This is BpfLoader v0.20 +// This is BpfLoader v0.21 #define BPFLOADER_VERSION_MAJOR 0u -#define BPFLOADER_VERSION_MINOR 20u +#define BPFLOADER_VERSION_MINOR 21u #define BPFLOADER_VERSION ((BPFLOADER_VERSION_MAJOR << 16) | BPFLOADER_VERSION_MINOR) #include "bpf/BpfUtils.h" @@ -877,13 +877,6 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector& return -err; } } - ret = chown(mapPinLoc.c_str(), (uid_t)md[i].uid, (gid_t)md[i].gid); - if (ret) { - int err = errno; - ALOGE("chown(%s, %u, %u) = %d [%d:%s]", mapPinLoc.c_str(), md[i].uid, md[i].gid, - ret, err, strerror(err)); - return -err; - } ret = chmod(mapPinLoc.c_str(), md[i].mode); if (ret) { int err = errno; @@ -891,6 +884,13 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector& strerror(err)); return -err; } + ret = chown(mapPinLoc.c_str(), (uid_t)md[i].uid, (gid_t)md[i].gid); + if (ret) { + int err = errno; + ALOGE("chown(%s, %u, %u) = %d [%d:%s]", mapPinLoc.c_str(), md[i].uid, md[i].gid, + ret, err, strerror(err)); + return -err; + } } struct bpf_map_info map_info = {};