Commit 38ef9154 authored by Michael Ira Krufky's avatar Michael Ira Krufky Committed by Jean-Paul Saman

dvbinfo: fix error: 'daemon' is deprecated: first deprecated in OS X 10.5...

dvbinfo: fix error: 'daemon' is deprecated: first deprecated in OS X 10.5 [-Werror,-Wdeprecated-declarations]

I'm not sure if you will want to apply this patch, but I thought I
should share it and let you decide.  I need it in order to build
libdvbpsi on OSX Mavericks, but I don't actually use the dvbinfo
program.

Fix the following build error when building under OSX:

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
dvbinfo.c:656:13: error: 'daemon' is deprecated: first deprecated in OS X 10.5 [-Werror,-Wdeprecated-declarations]
        if (daemon(1,0) < 0)
            ^
/usr/include/stdlib.h:267:6: note: 'daemon' declared here
int      daemon(int, int) __DARWIN_1050(daemon) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_5, __IPHONE_2_0, __IPHONE_2_0);
         ^
1 error generated.
make[3]: *** [dvbinfo-dvbinfo.o] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Signed-off-by: default avatarMichael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: default avatarJean-Paul Saman <jpsaman@videolan.org>
parent a2b39ffb
...@@ -22,6 +22,14 @@ ...@@ -22,6 +22,14 @@
#include "config.h" #include "config.h"
#if __APPLE__
// In Mac OS X 10.5 and later trying to use the daemon function gives a “‘daemon’ is deprecated”
// error, which prevents compilation because we build with "-Werror".
// Since this is supposed to be portable cross-platform code, we don't care that daemon is
// deprecated on Mac OS X 10.5, so we use this preprocessor trick to eliminate the error message.
#define daemon yes_we_know_that_daemon_is_deprecated_in_os_x_10_5_thankyou
#endif
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdbool.h> #include <stdbool.h>
...@@ -68,6 +76,11 @@ ...@@ -68,6 +76,11 @@
# include "tcp.h" # include "tcp.h"
#endif #endif
#if __APPLE__
#undef daemon
extern int daemon(int, int);
#endif
#define FIFO_THRESHOLD_SIZE (400 * 1024 * 1024) /* threshold in bytes */ #define FIFO_THRESHOLD_SIZE (400 * 1024 * 1024) /* threshold in bytes */
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment