Description: Rename LOG_ERR in LOG_ERR_KOP to fix the build failure with newer glibc

In file included from /<<PKGBUILDDIR>>/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.cc:47:
/<<PKGBUILDDIR>>/protocols/jabber/libjingle/talk/base/logging.h:365: warning: "LOG_ERR" redefined
  365 | #define LOG_ERR(sev) \
      | 
In file included from /usr/include/syslog.h:1,
                 from /usr/include/bctoolbox/logging.h:263,
                 from /usr/include/ortp/logging.h:33,
                 from /usr/include/ortp/ortp.h:66,
                 from /usr/include/mediastreamer2/mediastream.h:24,
                 from /<<PKGBUILDDIR>>/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.cc:38:
/usr/include/x86_64-linux-gnu/sys/syslog.h:54: note: this is the location of the previous definition
   54 | #define LOG_ERR  3 /* error conditions */
      | 
In file included from /usr/include/c++/10/bits/stringfwd.h:40,
                 from /usr/include/c++/10/string:39,
                 from /usr/include/bctoolbox/logging.h:258,
                 from /usr/include/ortp/logging.h:33,
                 from /usr/include/ortp/ortp.h:66,
                 from /usr/include/mediastreamer2/mediastream.h:24,
                 from /<<PKGBUILDDIR>>/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.cc:38:
/usr/include/c++/10/bits/memoryfwd.h:63:3: error: template with C linkage
   63 |   template<typename>
      |   ^~~~~~~~
/<<PKGBUILDDIR>>/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.cc:37:1: note: ‘extern "C"’ linkage started here


Author: Gianfranco Costamagna <locutusofborg@debian.org>

Last-Update: 2020-12-28

--- kopete-20.12.0.orig/protocols/jabber/libjingle/talk/base/cpumonitor.cc
+++ kopete-20.12.0/protocols/jabber/libjingle/talk/base/cpumonitor.cc
@@ -140,11 +140,11 @@ bool CpuSampler::Init() {
   Pathname sname("/proc/stat");
   sfile_.reset(Filesystem::OpenFile(sname, "rb"));
   if (sfile_.get() == NULL) {
-    LOG_ERR(LS_ERROR) << "open proc/stat failed:";
+    LOG_ERR_KOP(LS_ERROR) << "open proc/stat failed:";
     return false;
   }
   if (!sfile_->DisableBuffering()) {
-    LOG_ERR(LS_ERROR) << "could not disable buffering for proc/stat";
+    LOG_ERR_KOP(LS_ERROR) << "could not disable buffering for proc/stat";
     return false;
   }
 #endif // defined(LINUX) || defined(ANDROID)
@@ -264,7 +264,7 @@ float CpuSampler::GetSystemLoad() {
   std::string statbuf;
   sfile_->SetPosition(0);
   if (!sfile_->ReadLine(&statbuf)) {
-    LOG_ERR(LS_ERROR) << "Could not read proc/stat file";
+    LOG_ERR_KOP(LS_ERROR) << "Could not read proc/stat file";
     return 0.f;
   }
 
@@ -275,7 +275,7 @@ float CpuSampler::GetSystemLoad() {
   if (sscanf(statbuf.c_str(), "cpu %Lu %Lu %Lu %Lu",
              &user, &nice,
              &system, &idle) != 4) {
-    LOG_ERR(LS_ERROR) << "Could not parse cpu info";
+    LOG_ERR_KOP(LS_ERROR) << "Could not parse cpu info";
     return 0.f;
   }
   const uint64 cpu_times = nice + system + user;
@@ -351,7 +351,7 @@ float CpuSampler::GetProcessLoad() {
 #if defined(LINUX) || defined(ANDROID)
   rusage usage;
   if (getrusage(RUSAGE_SELF, &usage) < 0) {
-    LOG_ERR(LS_ERROR) << "getrusage failed";
+    LOG_ERR_KOP(LS_ERROR) << "getrusage failed";
     return 0.f;
   }
 
--- kopete-20.12.0.orig/protocols/jabber/libjingle/talk/base/linux.cc
+++ kopete-20.12.0/protocols/jabber/libjingle/talk/base/linux.cc
@@ -288,7 +288,7 @@ std::string ReadLinuxLsbRelease() {
   // No cached result. Run lsb_release and parse output.
   POpenStream lsb_release_output;
   if (!lsb_release_output.Open("lsb_release -idrcs", "r", NULL)) {
-    LOG_ERR(LS_ERROR) << "Can't run lsb_release";
+    LOG_ERR_KOP(LS_ERROR) << "Can't run lsb_release";
     return lsb_release_string;  // empty
   }
   // Read in the command's output and build the string.
@@ -335,7 +335,7 @@ std::string ReadLinuxLsbRelease() {
 std::string ReadLinuxUname() {
   struct utsname buf;
   if (uname(&buf) < 0) {
-    LOG_ERR(LS_ERROR) << "Can't call uname()";
+    LOG_ERR_KOP(LS_ERROR) << "Can't call uname()";
     return std::string();
   }
   std::ostringstream sstr;
--- kopete-20.12.0.orig/protocols/jabber/libjingle/talk/base/logging.h
+++ kopete-20.12.0/protocols/jabber/libjingle/talk/base/logging.h
@@ -47,7 +47,7 @@
 // LOG_ERRNO(sev) attempts to add a string description of an errno-derived
 //     error. errno and associated facilities exist on both Windows and POSIX,
 //     but on Windows they only apply to the C/C++ runtime.
-// LOG_ERR(sev) is an alias for the platform's normal error system, i.e. _GLE on
+// LOG_ERR_KOP(sev) is an alias for the platform's normal error system, i.e. _GLE on
 //     Windows and _ERRNO on POSIX.
 // (The above three also all have _EX versions that let you specify the error
 // code, rather than using the last one.)
@@ -355,14 +355,14 @@ inline bool LogCheckLevel(LoggingSeverit
   LOG_E(sev, HRESULT, GetLastError(), mod)
 #define LOG_ERR_EX(sev, err) \
   LOG_GLE_EX(sev, err)
-#define LOG_ERR(sev) \
+#define LOG_ERR_KOP(sev) \
   LOG_GLE(sev)
 #define LAST_SYSTEM_ERROR \
   (::GetLastError())
 #elif POSIX
 #define LOG_ERR_EX(sev, err) \
   LOG_ERRNO_EX(sev, err)
-#define LOG_ERR(sev) \
+#define LOG_ERR_KOP(sev) \
   LOG_ERRNO(sev)
 #define LAST_SYSTEM_ERROR \
   (errno)
--- kopete-20.12.0.orig/protocols/jabber/libjingle/talk/base/network.cc
+++ kopete-20.12.0/protocols/jabber/libjingle/talk/base/network.cc
@@ -189,7 +189,7 @@ bool BasicNetworkManager::CreateNetworks
   struct ifaddrs* interfaces;
   int error = getifaddrs(&interfaces);
   if (error != 0) {
-    LOG_ERR(LERROR) << "getifaddrs failed to gather interface data: " << error;
+    LOG_ERR_KOP(LERROR) << "getifaddrs failed to gather interface data: " << error;
     return false;
   }
   struct ifaddrs* cursor = interfaces;
--- kopete-20.12.0.orig/protocols/jabber/libjingle/talk/base/physicalsocketserver.cc
+++ kopete-20.12.0/protocols/jabber/libjingle/talk/base/physicalsocketserver.cc
@@ -654,14 +654,14 @@ class PosixSignalHandler {
  private:
   PosixSignalHandler() {
     if (pipe(afd_) < 0) {
-      LOG_ERR(LS_ERROR) << "pipe failed";
+      LOG_ERR_KOP(LS_ERROR) << "pipe failed";
       return;
     }
     if (fcntl(afd_[0], F_SETFL, O_NONBLOCK) < 0) {
-      LOG_ERR(LS_WARNING) << "fcntl #1 failed";
+      LOG_ERR_KOP(LS_WARNING) << "fcntl #1 failed";
     }
     if (fcntl(afd_[1], F_SETFL, O_NONBLOCK) < 0) {
-      LOG_ERR(LS_WARNING) << "fcntl #2 failed";
+      LOG_ERR_KOP(LS_WARNING) << "fcntl #2 failed";
     }
     memset(const_cast<void *>(static_cast<volatile void *>(received_signal_)),
            0,
@@ -720,7 +720,7 @@ class PosixSignalDispatcher : public Dis
     uint8 b[16];
     ssize_t ret = read(GetDescriptor(), b, sizeof(b));
     if (ret < 0) {
-      LOG_ERR(LS_WARNING) << "Error in read()";
+      LOG_ERR_KOP(LS_WARNING) << "Error in read()";
     } else if (ret == 0) {
       LOG(LS_WARNING) << "Should have read at least one byte";
     }
@@ -835,7 +835,7 @@ class SocketDispatcher : public Dispatch
           // "connection lost"-type error as a blocking error, because typically
           // the next recv() will get EOF, so we'll still eventually notice that
           // the socket is closed.
-          LOG_ERR(LS_WARNING) << "Assuming benign blocking error";
+          LOG_ERR_KOP(LS_WARNING) << "Assuming benign blocking error";
           return false;
       }
     }
@@ -1438,7 +1438,7 @@ bool PhysicalSocketServer::InstallSignal
   struct sigaction act;
   // It doesn't really matter what we set this mask to.
   if (sigemptyset(&act.sa_mask) != 0) {
-    LOG_ERR(LS_ERROR) << "Couldn't set mask";
+    LOG_ERR_KOP(LS_ERROR) << "Couldn't set mask";
     return false;
   }
   act.sa_handler = handler;
@@ -1447,7 +1447,7 @@ bool PhysicalSocketServer::InstallSignal
   // real standard for which ones. :(
   act.sa_flags = SA_RESTART;
   if (sigaction(signum, &act, NULL) != 0) {
-    LOG_ERR(LS_ERROR) << "Couldn't set sigaction";
+    LOG_ERR_KOP(LS_ERROR) << "Couldn't set sigaction";
     return false;
   }
   return true;
--- kopete-20.12.0.orig/protocols/jabber/libjingle/talk/base/posix.cc
+++ kopete-20.12.0/protocols/jabber/libjingle/talk/base/posix.cc
@@ -63,7 +63,7 @@ bool RunAsDaemon(const char *file, const
   // Fork intermediate child to daemonize.
   pid_t pid = fork();
   if (pid < 0) {
-    LOG_ERR(LS_ERROR) << "fork()";
+    LOG_ERR_KOP(LS_ERROR) << "fork()";
     return false;
   } else if (!pid) {
     // Child.
@@ -112,7 +112,7 @@ bool RunAsDaemon(const char *file, const
   int status;
   pid_t child = waitpid(pid, &status, 0);
   if (child < 0) {
-    LOG_ERR(LS_ERROR) << "Error in waitpid()";
+    LOG_ERR_KOP(LS_ERROR) << "Error in waitpid()";
     return false;
   }
   if (child != pid) {
--- kopete-20.12.0.orig/protocols/jabber/libjingle/talk/base/socketadapters.cc
+++ kopete-20.12.0/protocols/jabber/libjingle/talk/base/socketadapters.cc
@@ -123,7 +123,7 @@ void BufferedReadAdapter::OnReadEvent(As
   int len = socket_->Recv(buffer_ + data_len_, buffer_size_ - data_len_);
   if (len < 0) {
     // TODO: Do something better like forwarding the error to the user.
-    LOG_ERR(INFO) << "Recv";
+    LOG_ERR_KOP(INFO) << "Recv";
     return;
   }
 
--- kopete-20.12.0.orig/protocols/jabber/libjingle/talk/base/thread.cc
+++ kopete-20.12.0/protocols/jabber/libjingle/talk/base/thread.cc
@@ -157,7 +157,7 @@ bool Thread::SleepMs(int milliseconds) {
   ts.tv_nsec = (milliseconds % 1000) * 1000000;
   int ret = nanosleep(&ts, NULL);
   if (ret != 0) {
-    LOG_ERR(LS_WARNING) << "nanosleep() returning early";
+    LOG_ERR_KOP(LS_WARNING) << "nanosleep() returning early";
     return false;
   }
   return true;
--- kopete-20.12.0.orig/protocols/jabber/libjingle/talk/base/unixfilesystem.cc
+++ kopete-20.12.0/protocols/jabber/libjingle/talk/base/unixfilesystem.cc
@@ -124,12 +124,12 @@ bool UnixFilesystem::CreatePrivateFile(c
                 O_RDWR | O_CREAT | O_EXCL,
                 S_IRUSR | S_IWUSR);
   if (fd < 0) {
-    LOG_ERR(LS_ERROR) << "open() failed.";
+    LOG_ERR_KOP(LS_ERROR) << "open() failed.";
     return false;
   }
   // Don't need to keep the file descriptor.
   if (close(fd) < 0) {
-    LOG_ERR(LS_ERROR) << "close() failed.";
+    LOG_ERR_KOP(LS_ERROR) << "close() failed.";
     // Continue.
   }
   return true;
@@ -508,7 +508,7 @@ Pathname UnixFilesystem::GetCurrentDirec
   char *path = getcwd(buffer, PATH_MAX);
 
   if (!path) {
-    LOG_ERR(LS_ERROR) << "getcwd() failed";
+    LOG_ERR_KOP(LS_ERROR) << "getcwd() failed";
     return cwd;  // returns empty pathname
   }
   cwd.SetFolder(std::string(path));
--- kopete-20.12.0.orig/protocols/jabber/libjingle/talk/base/win32filesystem.cc
+++ kopete-20.12.0/protocols/jabber/libjingle/talk/base/win32filesystem.cc
@@ -97,7 +97,7 @@ bool Win32Filesystem::CreatePrivateFile(
   if (!::OpenProcessToken(::GetCurrentProcess(),
                           TOKEN_QUERY,
                           &process_token)) {
-    LOG_ERR(LS_ERROR) << "OpenProcessToken() failed";
+    LOG_ERR_KOP(LS_ERROR) << "OpenProcessToken() failed";
     return false;
   }
 
@@ -123,12 +123,12 @@ bool Win32Filesystem::CreatePrivateFile(
   // We're now done with this.
   ::CloseHandle(process_token);
   if (!success) {
-    LOG_ERR(LS_ERROR) << "GetTokenInformation() failed";
+    LOG_ERR_KOP(LS_ERROR) << "GetTokenInformation() failed";
     return false;
   }
 
   if (!IsValidSid(token_user->User.Sid)) {
-    LOG_ERR(LS_ERROR) << "Current process has invalid user SID";
+    LOG_ERR_KOP(LS_ERROR) << "Current process has invalid user SID";
     return false;
   }
 
@@ -141,7 +141,7 @@ bool Win32Filesystem::CreatePrivateFile(
   PACL acl = reinterpret_cast<PACL>(acl_bytes.get());
   memset(acl, 0, acl_size);
   if (!::InitializeAcl(acl, acl_size, ACL_REVISION)) {
-    LOG_ERR(LS_ERROR) << "InitializeAcl() failed";
+    LOG_ERR_KOP(LS_ERROR) << "InitializeAcl() failed";
     return false;
   }
 
@@ -150,7 +150,7 @@ bool Win32Filesystem::CreatePrivateFile(
                              ACL_REVISION,
                              GENERIC_READ | GENERIC_WRITE | STANDARD_RIGHTS_ALL,
                              token_user->User.Sid)) {
-    LOG_ERR(LS_ERROR) << "AddAccessAllowedAce() failed";
+    LOG_ERR_KOP(LS_ERROR) << "AddAccessAllowedAce() failed";
     return false;
   }
 
@@ -158,7 +158,7 @@ bool Win32Filesystem::CreatePrivateFile(
   SECURITY_DESCRIPTOR security_descriptor;
   if (!::InitializeSecurityDescriptor(&security_descriptor,
                                       SECURITY_DESCRIPTOR_REVISION)) {
-    LOG_ERR(LS_ERROR) << "InitializeSecurityDescriptor() failed";
+    LOG_ERR_KOP(LS_ERROR) << "InitializeSecurityDescriptor() failed";
     return false;
   }
 
@@ -167,7 +167,7 @@ bool Win32Filesystem::CreatePrivateFile(
                                    TRUE,
                                    acl,
                                    FALSE)) {
-    LOG_ERR(LS_ERROR) << "SetSecurityDescriptorDacl() failed";
+    LOG_ERR_KOP(LS_ERROR) << "SetSecurityDescriptorDacl() failed";
     return false;
   }
 
@@ -185,11 +185,11 @@ bool Win32Filesystem::CreatePrivateFile(
       0,
       NULL);
   if (INVALID_HANDLE_VALUE == handle) {
-    LOG_ERR(LS_ERROR) << "CreateFile() failed";
+    LOG_ERR_KOP(LS_ERROR) << "CreateFile() failed";
     return false;
   }
   if (!::CloseHandle(handle)) {
-    LOG_ERR(LS_ERROR) << "CloseFile() failed";
+    LOG_ERR_KOP(LS_ERROR) << "CloseFile() failed";
     // Continue.
   }
   return true;
--- kopete-20.12.0.orig/protocols/jabber/libjingle/talk/p2p/base/relayserver.cc
+++ kopete-20.12.0/protocols/jabber/libjingle/talk/p2p/base/relayserver.cc
@@ -56,7 +56,7 @@ void Send(talk_base::AsyncPacketSocket*
     LOG(LS_ERROR) << "SendTo wrote only " << result << " of " << size
                   << " bytes";
   } else if (result < 0) {
-    LOG_ERR(LS_ERROR) << "SendTo";
+    LOG_ERR_KOP(LS_ERROR) << "SendTo";
   }
 }
 
--- kopete-20.12.0.orig/protocols/jabber/libjingle/talk/p2p/base/stunserver.cc
+++ kopete-20.12.0/protocols/jabber/libjingle/talk/p2p/base/stunserver.cc
@@ -145,7 +145,7 @@ void StunServer::SendResponse(
   // TODO: Allow response addr attribute if sent from another stun server.
 
   if (socket_->SendTo(buf.Data(), buf.Length(), addr) < 0)
-    LOG_ERR(LS_ERROR) << "sendto";
+    LOG_ERR_KOP(LS_ERROR) << "sendto";
 }
 
 }  // namespace cricket
--- kopete-20.12.0.orig/protocols/jabber/libjingle/talk/session/phone/linuxdevicemanager.cc
+++ kopete-20.12.0/protocols/jabber/libjingle/talk/session/phone/linuxdevicemanager.cc
@@ -315,7 +315,7 @@ bool LinuxDeviceWatcher::Start() {
   }
   udev_ = LATE(udev_new)();
   if (!udev_) {
-    LOG_ERR(LS_ERROR) << "udev_new()";
+    LOG_ERR_KOP(LS_ERROR) << "udev_new()";
     return true;
   }
   // The second argument here is the event source. It can be either "kernel" or
@@ -323,7 +323,7 @@ bool LinuxDeviceWatcher::Start() {
   // udev daemon in turn listens on the kernel.
   udev_monitor_ = LATE(udev_monitor_new_from_netlink)(udev_, "udev");
   if (!udev_monitor_) {
-    LOG_ERR(LS_ERROR) << "udev_monitor_new_from_netlink()";
+    LOG_ERR_KOP(LS_ERROR) << "udev_monitor_new_from_netlink()";
     return true;
   }
   // We only listen for changes in the video devices. Audio devices are more or
@@ -337,11 +337,11 @@ bool LinuxDeviceWatcher::Start() {
   if (LATE(udev_monitor_filter_add_match_subsystem_devtype)(udev_monitor_,
                                                             "video4linux",
                                                             NULL) < 0) {
-    LOG_ERR(LS_ERROR) << "udev_monitor_filter_add_match_subsystem_devtype()";
+    LOG_ERR_KOP(LS_ERROR) << "udev_monitor_filter_add_match_subsystem_devtype()";
     return true;
   }
   if (LATE(udev_monitor_enable_receiving)(udev_monitor_) < 0) {
-    LOG_ERR(LS_ERROR) << "udev_monitor_enable_receiving()";
+    LOG_ERR_KOP(LS_ERROR) << "udev_monitor_enable_receiving()";
     return true;
   }
   static_cast<talk_base::PhysicalSocketServer*>(
@@ -380,7 +380,7 @@ void LinuxDeviceWatcher::OnEvent(uint32
   if (!device) {
     // Probably the socket connection to the udev daemon was terminated (perhaps
     // the daemon crashed or is being restarted?).
-    LOG_ERR(LS_WARNING) << "udev_monitor_receive_device()";
+    LOG_ERR_KOP(LS_WARNING) << "udev_monitor_receive_device()";
     // Stop listening to avoid potential livelock (an fd with EOF in it is
     // always considered readable).
     static_cast<talk_base::PhysicalSocketServer*>(
