.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd January 15, 2020
+.Dd January 22, 2020
.Dt DHCPCD 8
.Os
.Sh NAME
To work around it, try and impersonate Windows by using the MSFT vendorclassid.
.It Fl j , Fl Fl logfile Ar logfile
Writes to the specified
-.Ar logfile
-rather than
+.Ar logfile .
+.Nm
+still writes to
.Xr syslog 3 .
The
.Ar logfile
.Sh AUTHORS
.An Roy Marples Aq Mt roy@marples.name
.Sh BUGS
+If
+.Nm
+is running in a
+.Xr chroot 2
+then re-opening the
+.Fl Fl logfile
+from SIGUSR2 may not work.
+.Pp
Please report them to
.Lk http://roy.marples.name/projects/dhcpcd
!(ctx->options & DHCPCD_DAEMONISE))
return;
- loginfox("forked to background, child pid %d", getpid());
+ /* Don't use loginfo because this makes no sense in a log. */
+ fprintf(stderr, "forked to background, child pid %d\n", getpid());
i = EXIT_SUCCESS;
if (write(ctx->fork_fd, &i, sizeof(i)) == -1)
logerr("write");
return;
case SIGUSR2:
loginfox(sigmsg, "SIGUSR2", "reopening log");
+ /* XXX This may not work that well in a chroot */
logclose();
if (logopen(ctx->logfile) == -1)
logerr(__func__);
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd January 15, 2020
+.Dd January 22, 2020
.Dt DHCPCD.CONF 5
.Os
.Sh NAME
this may not be desirable on heavily loaded systems.
.It Ic logfile Ar logfile
Writes to the specified
-.Ar logfile
-rather than
+.Ar logfile .
+.Nm dhcpcd
+still writes to
.Xr syslog 3 .
The
.Ar logfile
if (!(ctx->log_opts & LOGERR_LOG))
return len;
-#ifdef SMALL
+#ifndef SMALL
+ if (ctx->log_file != NULL &&
+ (pri != LOG_DEBUG || (ctx->log_opts & LOGERR_DEBUG)))
+ len = vlogprintf_r(ctx, ctx->log_file, fmt, args);
+#endif
+
vsyslog(pri, fmt, args);
return len;
-#else
- if (ctx->log_file == NULL) {
- vsyslog(pri, fmt, args);
- return len;
- }
- if (pri == LOG_DEBUG && !(ctx->log_opts & LOGERR_DEBUG))
- return len;
- return vlogprintf_r(ctx, ctx->log_file, fmt, args);
-#endif
}
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5))
#pragma GCC diagnostic pop
#define st_atimespec st_atim
#define st_mtimespec st_mtim
#endif
-static ssize_t
-ps_root_docopy(struct dhcpcd_ctx *ctx, const char *file)
+ssize_t
+ps_root_docopychroot(struct dhcpcd_ctx *ctx, const char *file)
{
char path[PATH_MAX], buf[BUFSIZ], *slash;
switch(op) {
case PS_COPY:
- return ps_root_docopy(ctx, path);
+ return ps_root_docopychroot(ctx, path);
case PS_UNLINK:
return (ssize_t)unlink(path);
default:
int ps_root_stop(struct dhcpcd_ctx *ctx);
ssize_t ps_root_readerror(struct dhcpcd_ctx *);
+ssize_t ps_root_docopychroot(struct dhcpcd_ctx *, const char *);
ssize_t ps_root_copychroot(struct dhcpcd_ctx *, const char *);
ssize_t ps_root_ioctl(struct dhcpcd_ctx *, ioctl_request_t, void *, size_t);
ssize_t ps_root_unlink(struct dhcpcd_ctx *, const char *);
chmod(path, 0755) == -1)
logerr("%s: %s", __func__, path);
+ /* Ensure we have a localtime to correctly format dates. */
+ if (ps_root_docopychroot(ctx, "/etc/localtime") == -1 && errno!=ENOENT)
+ logerr("%s: %s", __func__, "/etc/localtime");
+
ctx->options |= DHCPCD_PRIVSEP;
return 0;
}