package/ola: fix build with musl 1.2.3

Fix the following build failure with musl 1.2.3:

ola/AutoStart.cpp: In function 'ola::network::TCPSocket* ola::client::ConnectToServer(short unsigned int)':
ola/AutoStart.cpp:116:12: error: invalid cast from type 'std::nullptr_t' to type 'char*'
  116 |            reinterpret_cast<char*>(NULL));
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/88be323e64f66433cabc962e719307b5fb6a6177

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
Fabrice Fontaine 2022-07-14 11:36:15 +02:00 committed by Yann E. MORIN
parent 33599d5f35
commit e23b230a20

View file

@ -0,0 +1,35 @@
From eb31017284f9a1c95602a9c06d606df6b558a691 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Thu, 14 Apr 2022 17:39:32 -0700
Subject: [PATCH] ola: fix compilation with musl 1.2.3
musl 1.2.3 defines NULL as nullptr. cannot use reinterpret_cast with
nullptr.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
[Retrieved from:
https://github.com/OpenLightingProject/ola/pull/1773/commits/eb31017284f9a1c95602a9c06d606df6b558a691]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
ola/AutoStart.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ola/AutoStart.cpp b/ola/AutoStart.cpp
index 89fa51f115..4dbe20d317 100644
--- a/ola/AutoStart.cpp
+++ b/ola/AutoStart.cpp
@@ -110,11 +110,11 @@ TCPSocket *ConnectToServer(unsigned short port) {
// Try to start the server, we pass --daemon (fork into background) and
// --syslog (log to syslog).
execlp("olad", "olad", "--daemon", "--syslog",
-#ifdef __FreeBSD__
- reinterpret_cast<char*>(0));
+#if __cplusplus >= 201103L
+ nullptr);
#else
reinterpret_cast<char*>(NULL));
-#endif // __FreeBSD__
+#endif // __cplusplus >= 201103L
OLA_WARN << "Failed to exec: " << strerror(errno);
_exit(1);
}