changeset 5315:e4e369bdb914 draft

Linux: resource limits don't easily work here either....
author Roy Marples <roy@marples.name>
date Fri, 05 Jun 2020 13:51:51 +0100
parents 11e07bba68c3
children 0a99cd624a1c
files src/if.c src/privsep.c
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/if.c	Fri Jun 05 13:15:51 2020 +0100
+++ b/src/if.c	Fri Jun 05 13:51:51 2020 +0100
@@ -127,8 +127,10 @@
 
 	if (ctx->pf_inet_fd != -1)
 		close(ctx->pf_inet_fd);
+#ifdef PF_LINK
 	if (ctx->pf_link_fd != -1)
 		close(ctx->pf_link_fd);
+#endif
 
 	if (ctx->priv) {
 		if_closesockets_os(ctx);
--- a/src/privsep.c	Fri Jun 05 13:15:51 2020 +0100
+++ b/src/privsep.c	Fri Jun 05 13:51:51 2020 +0100
@@ -113,7 +113,7 @@
 ps_dropprivs(struct dhcpcd_ctx *ctx)
 {
 	struct passwd *pw = ctx->ps_user;
-#if !defined(HAVE_PLEDGE)
+#if !defined(HAVE_PLEDGE) && !defined(__linux__)
 	struct rlimit rzero = { .rlim_cur = 0, .rlim_max = 0 };
 #endif
 
@@ -132,7 +132,7 @@
 		return -1;
 	}
 
-#ifdef HAVE_PLEDGE
+#if defined(HAVE_PLEDGE) || defined(__linux__)
 	/* None of these resource limits work with pledge. */
 #else
 	/* Prohibit new files, sockets, etc */