Commit 6b54d69a authored by Simon Kelley's avatar Simon Kelley

Make failure to chown() pidfile a warning.

parent 246a31cd
...@@ -5,7 +5,13 @@ dnsmasq (2.79-1) unstable; urgency=low ...@@ -5,7 +5,13 @@ dnsmasq (2.79-1) unstable; urgency=low
* Fix exit code for dhcp_release6 (closes: #833596) * Fix exit code for dhcp_release6 (closes: #833596)
* Add project homepage to control file. (closes: #887764) * Add project homepage to control file. (closes: #887764)
-- Simon Kelley <simon@thekelleys.org.uk> Tue, 6 Feb 2018 17:23:21 +0000 -- Simon Kelley <simon@thekelleys.org.uk> Thu, 8 Feb 2018 21:27:22 +0000
dnsmasq (2.78-3) unstable; urgency=high
* Make failure of pidfile chown a warning. (closes: #889857)
-- Simon Kelley <simon@thekelleys.org.uk> Thu, 8 Feb 2018 21:26:30 +0000
dnsmasq (2.78-2) unstable; urgency=high dnsmasq (2.78-2) unstable; urgency=high
......
...@@ -48,6 +48,7 @@ int main (int argc, char **argv) ...@@ -48,6 +48,7 @@ int main (int argc, char **argv)
long i, max_fd = sysconf(_SC_OPEN_MAX); long i, max_fd = sysconf(_SC_OPEN_MAX);
char *baduser = NULL; char *baduser = NULL;
int log_err; int log_err;
int chown_warn = 0;
#if defined(HAVE_LINUX_NETWORK) #if defined(HAVE_LINUX_NETWORK)
cap_user_header_t hdr = NULL; cap_user_header_t hdr = NULL;
cap_user_data_t data = NULL; cap_user_data_t data = NULL;
...@@ -547,8 +548,10 @@ int main (int argc, char **argv) ...@@ -547,8 +548,10 @@ int main (int argc, char **argv)
of the directory containing the file. That directory will of the directory containing the file. That directory will
need to by owned by the dnsmasq user, and the ownership of the need to by owned by the dnsmasq user, and the ownership of the
file has to match, to keep systemd >273 happy. */ file has to match, to keep systemd >273 happy. */
if ((getuid() == 0 && ent_pw && ent_pw->pw_uid != 0 && fchown(fd, ent_pw->pw_uid, ent_pw->pw_gid) == -1) || if (getuid() == 0 && ent_pw && ent_pw->pw_uid != 0 && fchown(fd, ent_pw->pw_uid, ent_pw->pw_gid) == -1)
!read_write(fd, (unsigned char *)daemon->namebuff, strlen(daemon->namebuff), 0)) chown_warn = errno;
if (!read_write(fd, (unsigned char *)daemon->namebuff, strlen(daemon->namebuff), 0))
err = 1; err = 1;
else else
{ {
...@@ -737,6 +740,9 @@ int main (int argc, char **argv) ...@@ -737,6 +740,9 @@ int main (int argc, char **argv)
} }
my_syslog(LOG_INFO, _("compile time options: %s"), compile_opts); my_syslog(LOG_INFO, _("compile time options: %s"), compile_opts);
if (chown_warn != 0)
my_syslog(LOG_WARNING, "chown of PID file %s failed: %s", daemon->runfile, strerror(chown_warn));
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
if (option_bool(OPT_DBUS)) if (option_bool(OPT_DBUS))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment