« Previous | Next » 

Revision f97742d0


Added by Alexandre Raymond over 10 years ago

Darwin: Fix compilation warning regarding the deprecated daemon() function

Changes since v1: create a wrapper function named qemu_daemon() in oslib-posix.c
instead of putting the OS specific workaround in qemu-nbd.c directly.

On OSX >= 10.5, daemon() is deprecated, resulting in the following warning:
qemu-nbd.c: In function ‘main’:
qemu-nbd.c:371: warning: ‘daemon’ is deprecated (declared at /usr/include/stdlib.h:289)

The following trick, used in mDNSResponder, takes care of this warning:

On OSX, it temporarily renames the daemon() function before including stdlib.h
and declares it manually as an extern function. This way, the compiler does not
see the declaration from stdlib.h and thus does not display the warning.

Signed-off-by: Alexandre Raymond <>
Cc: Blue Swirl <>
Signed-off-by: Andreas Färber <>


  • added
  • modified
  • copied
  • renamed
  • deleted

View differences