| @@ -1,15 +1,15 @@ | | | @@ -1,15 +1,15 @@ |
1 | #include <sys/cdefs.h> | | 1 | #include <sys/cdefs.h> |
2 | __RCSID("$NetBSD: common.c,v 1.16 2015/12/03 21:04:06 christos Exp $"); | | 2 | __RCSID("$NetBSD: common.c,v 1.17 2015/12/03 21:04:59 christos Exp $"); |
3 | | | 3 | |
4 | /* | | 4 | /* |
5 | * dhcpcd - DHCP client daemon | | 5 | * dhcpcd - DHCP client daemon |
6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> |
7 | * All rights reserved | | 7 | * All rights reserved |
8 | | | 8 | |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
15 | * notice, this list of conditions and the following disclaimer in the | | 15 | * notice, this list of conditions and the following disclaimer in the |
| @@ -171,27 +171,27 @@ logger(struct dhcpcd_ctx *ctx, int pri, | | | @@ -171,27 +171,27 @@ logger(struct dhcpcd_ctx *ctx, int pri, |
171 | { | | 171 | { |
172 | va_list vac; | | 172 | va_list vac; |
173 | | | 173 | |
174 | va_copy(vac, va); | | 174 | va_copy(vac, va); |
175 | #ifdef HAVE_PRINTF_M | | 175 | #ifdef HAVE_PRINTF_M |
176 | errno = serrno; | | 176 | errno = serrno; |
177 | #endif | | 177 | #endif |
178 | vfprintf(pri <= LOG_ERR ? stderr : stdout, fmt, vac); | | 178 | vfprintf(pri <= LOG_ERR ? stderr : stdout, fmt, vac); |
179 | fputc('\n', pri <= LOG_ERR ? stderr : stdout); | | 179 | fputc('\n', pri <= LOG_ERR ? stderr : stdout); |
180 | va_end(vac); | | 180 | va_end(vac); |
181 | } | | 181 | } |
182 | | | 182 | |
183 | /* Don't send to syslog if dumping leases or testing */ | | 183 | /* Don't send to syslog if dumping leases or testing */ |
184 | if (ctx->options & (DHCPCD_DUMPLEASE | DHCPCD_TEST)) | | 184 | if (ctx && ctx->options & (DHCPCD_DUMPLEASE | DHCPCD_TEST)) |
185 | goto out; | | 185 | goto out; |
186 | | | 186 | |
187 | if (ctx && ctx->log_fd != -1) { | | 187 | if (ctx && ctx->log_fd != -1) { |
188 | if (pri < LOG_DEBUG || (ctx->options & DHCPCD_DEBUG)) { | | 188 | if (pri < LOG_DEBUG || (ctx->options & DHCPCD_DEBUG)) { |
189 | struct timeval tv; | | 189 | struct timeval tv; |
190 | char buf[32]; | | 190 | char buf[32]; |
191 | | | 191 | |
192 | /* Write the time, syslog style. month day time - */ | | 192 | /* Write the time, syslog style. month day time - */ |
193 | if (gettimeofday(&tv, NULL) != -1) { | | 193 | if (gettimeofday(&tv, NULL) != -1) { |
194 | time_t now; | | 194 | time_t now; |
195 | struct tm tmnow; | | 195 | struct tm tmnow; |
196 | | | 196 | |
197 | tzset(); | | 197 | tzset(); |