Mercurial > hg > dhcpcd
changeset 5358:d2c66d08c2d7 draft
privsep: don't abort if setrlimit fails
Just log the error.
This allows valgrind to be used still as it uses big fd numbers in
the client.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Mon, 15 Jun 2020 15:14:53 +0100 |
| parents | 2ddfb6841ebb |
| children | e6b89e1a4077 |
| files | src/privsep.c |
| diffstat | 1 files changed, 6 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/privsep.c Mon Jun 15 12:52:55 2020 +0100 +++ b/src/privsep.c Mon Jun 15 15:14:53 2020 +0100 @@ -148,36 +148,28 @@ maxfd++; /* XXX why? */ struct rlimit rmaxfd = { - .rlim_cur = (unsigned long)maxfd, - .rlim_max = (unsigned long)maxfd + .rlim_cur = maxfd, + .rlim_max = maxfd }; - if (setrlimit(RLIMIT_NOFILE, &rmaxfd) == -1) { + if (setrlimit(RLIMIT_NOFILE, &rmaxfd) == -1) logerr("setrlimit RLIMIT_NOFILE"); - return -1; - } #else - if (setrlimit(RLIMIT_NOFILE, &rzero) == -1) { + if (setrlimit(RLIMIT_NOFILE, &rzero) == -1) logerr("setrlimit RLIMIT_NOFILE"); - return -1; - } #endif } /* Prohibit writing to files. * Obviously this won't work if we are using a logfile. */ if (ctx->logfile == NULL) { - if (setrlimit(RLIMIT_FSIZE, &rzero) == -1) { + if (setrlimit(RLIMIT_FSIZE, &rzero) == -1) logerr("setrlimit RLIMIT_FSIZE"); - return -1; - } } #ifdef RLIMIT_NPROC /* Prohibit forks */ - if (setrlimit(RLIMIT_NPROC, &rzero) == -1) { + if (setrlimit(RLIMIT_NPROC, &rzero) == -1) logerr("setrlimit RLIMIT_NPROC"); - return -1; - } #endif return 0;
