From: deraadt Date: Wed, 20 Jul 2016 19:40:04 +0000 (+0000) Subject: Shrink priv_write_file() API so that it does less, and the callers ask X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=24222f1c7f01ba2043b0a80b5a1862b354e38f50;p=openbsd Shrink priv_write_file() API so that it does less, and the callers ask it to do less. Discussion with guenther. ok krw --- diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 6e27d0e35e2..e05c1ed6561 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.375 2016/07/20 19:25:39 deraadt Exp $ */ +/* $OpenBSD: dhclient.c,v 1.376 2016/07/20 19:40:04 deraadt Exp $ */ /* * Copyright 2004 Henning Brauer @@ -2542,8 +2542,8 @@ priv_write_resolv_conf(struct imsg *imsg) sz = imsg->hdr.len - IMSG_HEADER_SIZE; priv_write_file("/etc/resolv.conf", - O_WRONLY | O_CREAT | O_TRUNC | O_SYNC | O_EXLOCK, - S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, 0, 0, contents, sz); + O_WRONLY | O_CREAT | O_TRUNC, + S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, contents, sz); } void @@ -2561,12 +2561,12 @@ priv_write_option_db(struct imsg *imsg) sz = imsg->hdr.len - IMSG_HEADER_SIZE; priv_write_file(path_option_db, - O_WRONLY | O_CREAT | O_TRUNC | O_SYNC | O_EXLOCK | O_NOFOLLOW, - S_IRUSR | S_IWUSR | S_IRGRP, 0, 0, contents, sz); + O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW, + S_IRUSR | S_IWUSR | S_IRGRP, contents, sz); } void -priv_write_file(char *path, int flags, mode_t mode, uid_t uid, gid_t gid, +priv_write_file(char *path, int flags, mode_t mode, u_int8_t *contents, size_t sz) { ssize_t n; diff --git a/sbin/dhclient/privsep.h b/sbin/dhclient/privsep.h index e985b1d29ea..a7854ff70df 100644 --- a/sbin/dhclient/privsep.h +++ b/sbin/dhclient/privsep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: privsep.h,v 1.29 2016/02/06 19:30:52 krw Exp $ */ +/* $OpenBSD: privsep.h,v 1.30 2016/07/20 19:40:04 deraadt Exp $ */ /* * Copyright (c) 2004 Henning Brauer @@ -67,4 +67,4 @@ void priv_cleanup(struct imsg_hup *); void priv_set_interface_mtu(struct imsg_set_interface_mtu *); void priv_write_resolv_conf(struct imsg *); void priv_write_option_db(struct imsg *); -void priv_write_file(char *, int, mode_t, uid_t, gid_t, u_int8_t *, size_t); +void priv_write_file(char *, int, mode_t, u_int8_t *, size_t);