summaryrefslogtreecommitdiff
path: root/src/option_processing.cc
diff options
context:
space:
mode:
authorNils Maier <maierman@web.de>2014-05-28 07:24:59 +0200
committerNils Maier <maierman@web.de>2014-05-29 19:38:34 +0200
commit3c55400d233edf42ffa3dde1fbf636c5b7c5c439 (patch)
tree5fcb9833e2f09f38708b1a4af14e6e9a3758da9b /src/option_processing.cc
parentb9fe4119c0f7165669e87cb1423efb030eb96c4d (diff)
Silence deprecation warning about daemon() on OSX
Diffstat (limited to 'src/option_processing.cc')
-rw-r--r--src/option_processing.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/option_processing.cc b/src/option_processing.cc
index 9be3a09e..9db33687 100644
--- a/src/option_processing.cc
+++ b/src/option_processing.cc
@@ -311,7 +311,18 @@ error_code::Value option_processing(Option& op, bool standalone,
}
}
if(standalone && op.getAsBool(PREF_DAEMON)) {
- if(daemon(0, 0) < 0) {
+#if defined(__GNUC__) && defined(__APPLE__)
+ // daemon() is deprecated on OSX since... forever.
+ // Silence the warning for good, so that -Werror becomes feasible.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif // defined(__GNUC__) && defined(__APPLE__)
+ const auto daemonized = daemon(0, 0);
+#if defined(__GNUC__) && defined(__APPLE__)
+#pragma GCC diagnostic pop
+#endif // defined(__GNUC__) && defined(__APPLE__)
+
+ if(daemonized < 0) {
perror(MSG_DAEMON_FAILED);
return error_code::UNKNOWN_ERROR;
}