build: avoid -Wignored-attributes on the popen deleter

- glibc declares pclose with function attributes (nothrow/leaf), so
  decltype(pclose)* carries attributes that gcc ignores on the unique_ptr
  template argument, emitting -Wignored-attributes
- spell the deleter as a plain int(*)(FILE*) instead; pclose converts to
  it silently and the deleter behaves identically (both popen branches)
This commit is contained in:
Dennis Klein
2026-06-09 21:32:27 +02:00
committed by Dennis Klein
parent ab4bc49088
commit 4b2c6cafac

View File

@@ -99,7 +99,7 @@ string getDefaultRouteNetworkInterface()
string interfaceName;
#ifdef __APPLE__ // MacOS
unique_ptr<FILE, decltype(pclose)*> file(
unique_ptr<FILE, int (*)(FILE*)> file(
popen("route -n get default | grep interface | cut -d \":\" -f 2", "r"), pclose);
#else // Linux
ifstream is("/proc/net/route");
@@ -128,7 +128,7 @@ string getDefaultRouteNetworkInterface()
LOG(debug) << "could not get network interface of the default route from /proc/net/route, "
"going to try via 'ip route'";
unique_ptr<FILE, decltype(pclose)*> file(
unique_ptr<FILE, int (*)(FILE*)> file(
popen("ip route | grep default | cut -d \" \" -f 5 | head -n 1", "r"), pclose);
#endif