BpfMap.h - fix cert-oop54-cpp compiler warning am: 54a7e769ae
Change-Id: I8bc6b3265062d197fe4761ba069610d64c2603d0
diff --git a/libbpf_android/include/bpf/BpfMap.h b/libbpf_android/include/bpf/BpfMap.h
index 8c35931..c92f989 100644
--- a/libbpf_android/include/bpf/BpfMap.h
+++ b/libbpf_android/include/bpf/BpfMap.h
@@ -129,8 +129,9 @@
const base::unique_fd& getMap() const { return mMapFd; };
// Copy assignment operator
- void operator=(const BpfMap<Key, Value>& other) {
- mMapFd.reset(fcntl(other.mMapFd.get(), F_DUPFD_CLOEXEC, 0));
+ BpfMap<Key, Value>& operator=(const BpfMap<Key, Value>& other) {
+ if (this != &other) mMapFd.reset(fcntl(other.mMapFd.get(), F_DUPFD_CLOEXEC, 0));
+ return *this;
}
// Move constructor