comparison src/privsep.c @ 5538:fc24946f9b2a draft

dhcpcd: Don't create launcher process if keeping in foreground There is little point.
author Roy Marples <roy@marples.name>
date Wed, 11 Nov 2020 17:44:55 +0000
parents a0d828e25482
children 8f7592a6f80d
comparison
equal deleted inserted replaced
5537:4492d1d88fdd 5538:fc24946f9b2a
161 if (setrlimit(RLIMIT_NOFILE, &rzero) == -1) 161 if (setrlimit(RLIMIT_NOFILE, &rzero) == -1)
162 logerr("setrlimit RLIMIT_NOFILE"); 162 logerr("setrlimit RLIMIT_NOFILE");
163 #endif 163 #endif
164 } 164 }
165 165
166 #define DHC_NOCHKIO (DHCPCD_STARTED | DHCPCD_DAEMONISE)
166 /* Prohibit writing to files. 167 /* Prohibit writing to files.
167 * Obviously this won't work if we are using a logfile 168 * Obviously this won't work if we are using a logfile
168 * or redirecting stderr to a file. */ 169 * or redirecting stderr to a file. */
169 if (ctx->logfile == NULL && 170 if ((ctx->options & DHC_NOCHKIO) == DHC_NOCHKIO ||
170 (ctx->options & DHCPCD_STARTED || 171 (ctx->logfile == NULL &&
171 !ctx->stderr_valid || isatty(STDERR_FILENO) == 1)) 172 (!ctx->stderr_valid || isatty(STDERR_FILENO) == 1)))
172 { 173 {
173 if (setrlimit(RLIMIT_FSIZE, &rzero) == -1) 174 if (setrlimit(RLIMIT_FSIZE, &rzero) == -1)
174 logerr("setrlimit RLIMIT_FSIZE"); 175 logerr("setrlimit RLIMIT_FSIZE");
175 } 176 }
176 177