summaryrefslogtreecommitdiffstats
path: root/usr.sbin/tzsetup
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>1999-08-05 11:48:47 +0000
committerru <ru@FreeBSD.org>1999-08-05 11:48:47 +0000
commit528f32365c8a1b8efd784a95970fd574d70a3ead (patch)
treeb7a8987f5064de8a9fe2de25f158eeb22e42817d /usr.sbin/tzsetup
parent75000c38838f6ae4afe9de4dd06bd3fde6120e1b (diff)
downloadFreeBSD-src-528f32365c8a1b8efd784a95970fd574d70a3ead.zip
FreeBSD-src-528f32365c8a1b8efd784a95970fd574d70a3ead.tar.gz
- ignore the user-supplied umask, set it to 0022 by default
- install /etc/wall_cmos_clock with 0444 mode rather than 0666 - -Wall inspection PR: 12967
Diffstat (limited to 'usr.sbin/tzsetup')
-rw-r--r--usr.sbin/tzsetup/tzsetup.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.sbin/tzsetup/tzsetup.c b/usr.sbin/tzsetup/tzsetup.c
index 7afda81..1648dd1 100644
--- a/usr.sbin/tzsetup/tzsetup.c
+++ b/usr.sbin/tzsetup/tzsetup.c
@@ -34,7 +34,7 @@
#ifndef lint
static const char rcsid[] =
- "$Id: tzsetup.c,v 1.12 1999/02/02 20:26:31 wollman Exp $";
+ "$Id: tzsetup.c,v 1.13 1999/06/23 03:31:36 mharo Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -510,8 +510,8 @@ install_zone_file(const char *filename)
unlink(_PATH_LOCALTIME);
fd2 = open(_PATH_LOCALTIME,
- O_CREAT | O_EXCL | O_WRONLY,
- 0444);
+ O_CREAT|O_EXCL|O_WRONLY,
+ S_IRUSR|S_IRGRP|S_IROTH);
if (fd2 < 0) {
asprintf(&msg, "Could not open "
_PATH_LOCALTIME ": %s",
@@ -527,7 +527,7 @@ install_zone_file(const char *filename)
if (len == -1) {
asprintf(&msg, "Error copying %s to "
_PATH_LOCALTIME ": %s",
- strerror(errno));
+ filename, strerror(errno));
dialog_mesgbox("Error", msg, 8, 72);
free(msg);
/* Better to leave none than a corrupt one. */
@@ -647,6 +647,9 @@ main(int argc, char **argv)
if (argc - optind > 1)
usage();
+ /* Override the user-supplied umask. */
+ (void)umask(S_IWGRP|S_IWOTH);
+
read_iso3166_table();
read_zones();
sort_countries();
@@ -661,7 +664,8 @@ main(int argc, char **argv)
} else {
if (reallydoit) {
fd = open(_PATH_WALL_CMOS_CLOCK,
- O_WRONLY|O_CREAT|O_TRUNC, 0666);
+ O_WRONLY|O_CREAT|O_TRUNC,
+ S_IRUSR|S_IRGRP|S_IROTH);
if (fd < 0)
err(1, "create %s", _PATH_WALL_CMOS_CLOCK);
close(fd);
OpenPOWER on IntegriCloud