Nsd looses timezone after chroot

After chrooting the timezone is wrong in the logging:

See (unpatched daemon ran first):
Sep 20 19:53:11 xmts nsd[32253]: nsd started (NSD 3.2.13), pid 32253
Sep 20 19:54:16 xmts nsd[32253]: signal received, shutting down...
Sep 20 21:54:18 xmts nsd[13502]: nsd started (NSD 3.2.13), pid 13502

chdir() after chroot() is good practice.

Note that unbound has the tzet() but not the chdir(). But I guess the
unbound devs read this list too? :slight_smile:

Regards,
Cam

(diff is against the OpenBSD tree)

Index: nsd.c

Hi Camiel,

After chrooting the timezone is wrong in the logging:

See (unpatched daemon ran first): Sep 20 19:53:11 xmts nsd[32253]:
nsd started (NSD 3.2.13), pid 32253 Sep 20 19:54:16 xmts
nsd[32253]: signal received, shutting down... Sep 20 21:54:18 xmts
nsd[13502]: nsd started (NSD 3.2.13), pid 13502

chdir() after chroot() is good practice.

Thanks for the patch. I updated unbound and nsd, to do tzset before
and chdir after the chroot. (slightly different than your patch, with
more detailed error messages for the chdir).

Best regards,
   Wouter

Note that unbound has the tzet() but not the chdir(). But I guess
the unbound devs read this list too? :slight_smile:

Regards, Cam

(diff is against the OpenBSD tree)

Index: nsd.c

RCS file: /cvs/src/usr.sbin/nsd/nsd.c,v