diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2014-02-07 18:12:18 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2014-02-07 18:12:18 +0000 |
commit | 13878075e529148c412b92b0d8b81c9fb88b012d (patch) | |
tree | ec40f810418e0d81c260722ea5097530b29d00e2 /sbin/dhclient | |
parent | ba14b6d5994d6360ded2c2f257f0b01c73abcfb1 (diff) |
Log failures to fchmod() or fchown() the file written in
priv_write_file().
Diffstat (limited to 'sbin/dhclient')
-rw-r--r-- | sbin/dhclient/dhclient.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index cce1b7493c9..8e610077187 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.289 2014/02/07 13:38:55 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.290 2014/02/07 18:12:17 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -2449,8 +2449,12 @@ priv_write_file(struct imsg_write_file *imsg) note("Short contents write to '%s' (%zd vs %zd)", imsg->path, n, imsg->len); - fchmod(fd, imsg->mode); - fchown(fd, imsg->uid, imsg->gid); + if (fchmod(fd, imsg->mode) == -1) + note("fchmod(fd, 0x%x) of '%s' failed (%s)", imsg->mode, + imsg->path, strerror(errno)); + if (fchown(fd, imsg->uid, imsg->gid) == -1) + note("fchown(fd, %d, %d) of '%s' failed (%s)", imsg->uid, + imsg->gid, imsg->path, strerror(errno)); close(fd); } |