aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am4
-rw-r--r--src/potd-init.c16
2 files changed, 19 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index d309e02..dede4d0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,7 @@
-sbin_PROGRAMS = potd
+sbin_PROGRAMS = potd potd-init
potd_SOURCES = compat.c utils.c options.c log.c log_colored.c log_file.c socket.c pevent.c capabilities.c filesystem.c jail.c forward.c redirector.c protocol.c protocol_ssh.c main.c
+potd_init_SOURCES = potd-init.c
+potd_init_LDFLAGS = -static
if HAVE_SECCOMP
potd_SOURCES += pseccomp.c
endif
diff --git a/src/potd-init.c b/src/potd-init.c
new file mode 100644
index 0000000..8cfb347
--- /dev/null
+++ b/src/potd-init.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#define APP_NAME "init"
+
+int main(void)
+{
+ if (getppid() != 0 || getpid() != 1) {
+ fprintf(stderr, "%s: must be started as PID 1\n", APP_NAME);
+ return 1;
+ }
+
+ return 0;
+}