Don't call daemon(3) on Fuchsia
Its semantics are dependent on those of fork, which we don't have.
Change-Id: I9d6cfb0a09dd92b72030803b6a8649a3935dc838
diff --git a/ssh.c b/ssh.c
index 0b34edf..f1156e5 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1507,7 +1507,10 @@
if (devnull > STDERR_FILENO)
close(devnull);
}
- daemon(1, 1);
+ // TODO(kulakowski) Fuchsia doesn't have fork(), and hence no
+ // daemon(3). Consider what semantics this actually needs and
+ // supply that, instead of calling daemon(1, 1) like this used
+ // to right here.
setproctitle("%s [mux]", options.control_path);
}
@@ -1519,8 +1522,11 @@
control_persist_detach();
debug("forking to background");
fork_after_authentication_flag = 0;
- if (daemon(1, 1) < 0)
- fatal("daemon() failed: %.200s", strerror(errno));
+ // TODO(kulakowski) Fuchsia doesn't have fork(), and hence no
+ // daemon(3). Consider what semantics this actually needs and
+ // supply that.
+ errno = ENOSYS;
+ fatal("daemon() failed: %.200s", strerror(errno));
}
/* Callback for remote forward global requests */
diff --git a/sshd.c b/sshd.c
index df694fe..c6fe3ee 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1824,8 +1824,11 @@
already_daemon = daemonized();
if (!(debug_flag || inetd_flag || no_daemon_flag || already_daemon)) {
- if (daemon(0, 0) < 0)
- fatal("daemon() failed: %.200s", strerror(errno));
+ // TODO(kulakowski) Fuchsia doesn't have fork(), and
+ // hence no daemon(3). Consider what semantics this
+ // actually needs and supply that.
+ errno = ENOSYS;
+ fatal("daemon() failed: %.200s", strerror(errno));
disconnect_controlling_tty();
}