Don't chroot() on OpenBSD (pledge() causes it to trap here)

This commit is contained in:
Jordan Bancino 2022-11-20 13:19:56 +00:00
parent c23f817a55
commit 0fa2da8177

View file

@ -386,6 +386,7 @@ main(int argc, char **argv)
if (getuid() == 0) if (getuid() == 0)
{ {
#ifndef __OpenBSD__ /* chroot() is only useful without unveil() */
if (chroot(".") == 0) if (chroot(".") == 0)
{ {
Log(lc, LOG_DEBUG, "Changed the root directory to: %s.", tConfig->dataDir); Log(lc, LOG_DEBUG, "Changed the root directory to: %s.", tConfig->dataDir);
@ -394,6 +395,7 @@ main(int argc, char **argv)
{ {
Log(lc, LOG_WARNING, "Unable to chroot into directory: %s.", tConfig->dataDir); Log(lc, LOG_WARNING, "Unable to chroot into directory: %s.", tConfig->dataDir);
} }
#endif
if (userInfo && groupInfo) if (userInfo && groupInfo)
{ {