mirror of
https://github.com/rsmarples/dhcpcd.git
synced 2024-11-28 04:25:19 +08:00
Allow quiet and nobackground to work in dhcpcd.conf
This commit is contained in:
parent
9d94cb7804
commit
03c2c87907
21
dhcpcd.c
21
dhcpcd.c
@ -1002,9 +1002,6 @@ main(int argc, char **argv)
|
||||
while ((opt = getopt_long(argc, argv, IF_OPTS, cf_options, &oi)) != -1)
|
||||
{
|
||||
switch (opt) {
|
||||
case 'b':
|
||||
options |= DHCPCD_BACKGROUND;
|
||||
break;
|
||||
case 'd':
|
||||
setlogmask(LOG_UPTO(LOG_DEBUG));
|
||||
break;
|
||||
@ -1017,16 +1014,9 @@ main(int argc, char **argv)
|
||||
case 'n':
|
||||
sig = SIGALRM;
|
||||
break;
|
||||
case 'q':
|
||||
setlogmask(LOG_UPTO(LOG_WARNING));
|
||||
options |= DHCPCD_QUIET;
|
||||
break;
|
||||
case 'x':
|
||||
sig = SIGTERM;
|
||||
break;
|
||||
case 'B':
|
||||
options &= ~DHCPCD_DAEMONISE;
|
||||
break;
|
||||
case 'T':
|
||||
options |= DHCPCD_TEST | DHCPCD_PERSISTENT;
|
||||
break;
|
||||
@ -1047,6 +1037,13 @@ main(int argc, char **argv)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
#ifdef THERE_IS_NO_FORK
|
||||
options &= ~DHCPCD_DAEMONISE;
|
||||
#endif
|
||||
|
||||
if (ifo->options & DHCPCD_QUIET)
|
||||
setlogmask(LOG_UPTO(LOG_WARNING));
|
||||
|
||||
/* If we have any other args, we should run as a single dhcpcd instance
|
||||
* for that interface. */
|
||||
len = strlen(PIDFILE) + IF_NAMESIZE + 2;
|
||||
@ -1057,10 +1054,6 @@ main(int argc, char **argv)
|
||||
snprintf(pidfile, len, PIDFILE, "", "");
|
||||
options |= DHCPCD_MASTER;
|
||||
}
|
||||
|
||||
#ifdef THERE_IS_NO_FORK
|
||||
options &= ~DHCPCD_DAEMONISE;
|
||||
#endif
|
||||
|
||||
chdir("/");
|
||||
umask(022);
|
||||
|
12
if-options.c
12
if-options.c
@ -257,15 +257,15 @@ parse_option(struct if_options *ifo, int opt, const char *arg)
|
||||
struct in_addr addr;
|
||||
|
||||
switch(opt) {
|
||||
case 'b': /* FALLTHROUGH */
|
||||
case 'd': /* FALLTHROUGH */
|
||||
case 'k': /* FALLTHROUGH */
|
||||
case 'n': /* FALLTHROUGH */
|
||||
case 'q': /* FALLTHROUGH */
|
||||
case 'x': /* FALLTHROUGH */
|
||||
case 'B': /* FALLTHROUGH */
|
||||
case 'T': /* We need to handle non interface options */
|
||||
break;
|
||||
case 'b':
|
||||
ifo->options |= DHCPCD_BACKGROUND;
|
||||
break;
|
||||
case 'c':
|
||||
strlcpy(ifo->script, arg, sizeof(ifo->script));
|
||||
break;
|
||||
@ -326,6 +326,9 @@ parse_option(struct if_options *ifo, int opt, const char *arg)
|
||||
case 'p':
|
||||
ifo->options |= DHCPCD_PERSISTENT;
|
||||
break;
|
||||
case 'q':
|
||||
ifo->options |= DHCPCD_QUIET;
|
||||
break;
|
||||
case 's':
|
||||
ifo->options |= DHCPCD_INFORM;
|
||||
ifo->options |= DHCPCD_PERSISTENT;
|
||||
@ -419,6 +422,9 @@ parse_option(struct if_options *ifo, int opt, const char *arg)
|
||||
/* IPv4LL requires ARP */
|
||||
ifo->options &= ~DHCPCD_IPV4LL;
|
||||
break;
|
||||
case 'B':
|
||||
ifo->options &= ~DHCPCD_DAEMONISE;
|
||||
break;
|
||||
case 'C':
|
||||
/* Commas to spaces for shell */
|
||||
while ((p = strchr(arg, ',')))
|
||||
|
Loading…
Reference in New Issue
Block a user