<div dir="ltr"><div><div>Michael,<br><br>I'll apply the patch anyway, since it should build cross-platform thus also on MacOS X Maverick.<br></div>Rewriting the code to not use daemon() function is something that can be done at a later time.<br>
<br>Thanks again for the patch.<br><br>Kind regards,<br></div>Jean-Paul Saman<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 16, 2014 at 3:48 AM, Michael Ira Krufky <span dir="ltr"><<a href="mailto:mkrufky@linuxtv.org" target="_blank">mkrufky@linuxtv.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm not sure if you will want to apply this patch, but I thought I<br>
should share it and let you decide.  I need it in order to build<br>
libdvbpsi on OSX Mavericks, but I don't actually use the dvbinfo<br>
program.<br>
<br>
Fix the following build error when building under OSX:<br>
<br>
gcc -DHAVE_CONFIG_H -I. -I../..  -D_FILE_OFFSET_BITS=64 -DDVBPSI_DIST   -g -O2 -Wall -Werror --std=gnu99 -D_GNU_SOURCE -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare -DDVBPSI_DIST -MT dvbinfo-dvbinfo.o -MD -MP -MF .deps/dvbinfo-dvbinfo.Tpo -c -o dvbinfo-dvbinfo.o `test -f 'dvbinfo.c' || echo './'`dvbinfo.c<br>

dvbinfo.c:656:13: error: 'daemon' is deprecated: first deprecated in OS X 10.5 [-Werror,-Wdeprecated-declarations]<br>
        if (daemon(1,0) < 0)<br>
            ^<br>
/usr/include/stdlib.h:267:6: note: 'daemon' declared here<br>
int      daemon(int, int) __DARWIN_1050(daemon) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_5, __IPHONE_2_0, __IPHONE_2_0);<br>
         ^<br>
1 error generated.<br>
make[3]: *** [dvbinfo-dvbinfo.o] Error 1<br>
make[2]: *** [all-recursive] Error 1<br>
make[1]: *** [all-recursive] Error 1<br>
make: *** [all] Error 2<br>
<br>
Signed-off-by: Michael Ira Krufky <<a href="mailto:mkrufky@linuxtv.org">mkrufky@linuxtv.org</a>><br>
---<br>
 examples/dvbinfo/dvbinfo.c | 13 +++++++++++++<br>
 1 file changed, 13 insertions(+)<br>
<br>
diff --git a/examples/dvbinfo/dvbinfo.c b/examples/dvbinfo/dvbinfo.c<br>
index 5ca7ea0..8a7417d 100644<br>
--- a/examples/dvbinfo/dvbinfo.c<br>
+++ b/examples/dvbinfo/dvbinfo.c<br>
@@ -22,6 +22,14 @@<br>
<br>
 #include "config.h"<br>
<br>
+#if __APPLE__<br>
+// In Mac OS X 10.5 and later trying to use the daemon function gives a “‘daemon’ is deprecated”<br>
+// error, which prevents compilation because we build with "-Werror".<br>
+// Since this is supposed to be portable cross-platform code, we don't care that daemon is<br>
+// deprecated on Mac OS X 10.5, so we use this preprocessor trick to eliminate the error message.<br>
+#define daemon yes_we_know_that_daemon_is_deprecated_in_os_x_10_5_thankyou<br>
+#endif<br>
+<br>
 #include <stdlib.h><br>
 #include <stdio.h><br>
 #include <stdbool.h><br>
@@ -68,6 +76,11 @@<br>
 #   include "tcp.h"<br>
 #endif<br>
<br>
+#if __APPLE__<br>
+#undef daemon<br>
+extern int daemon(int, int);<br>
+#endif<br>
+<br>
 #define FIFO_THRESHOLD_SIZE (400 * 1024 * 1024) /* threshold in bytes */<br>
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
1.8.3.2<br>
</font></span></blockquote></div><br></div>