ports/net/darkstat/patches/patch-pidfile_c

34 lines
927 B
Text
Raw Normal View History

2023-08-16 22:26:55 +00:00
Re-instate the chroot by default code.
Index: pidfile.c
--- pidfile.c.orig
+++ pidfile.c
@@ -29,9 +29,10 @@
static int pidfd = -1;
static const char *pidname = NULL;
-void pidfile_create(const char *chroot_dir,
- const char *filename,
- const char *privdrop_user) {
+void
+pidfile_create(const char *chroot_dir, const char *filename,
+ const char *privdrop_user)
+{
struct passwd *pw;
if (pidfd != -1)
@@ -47,11 +48,8 @@ void pidfile_create(const char *chroot_dir,
err(1, "getpwnam(\"%s\") failed", privdrop_user);
}
- if (chroot_dir != NULL) {
- if (chdir(chroot_dir) == -1) {
- err(1, "chdir(\"%s\") failed", chroot_dir);
- }
- }
+ if (chdir(chroot_dir) == -1)
+ err(1, "chdir(\"%s\") failed", chroot_dir);
pidname = filename;
pidfd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600);
if (pidfd == -1)