From 528f32365c8a1b8efd784a95970fd574d70a3ead Mon Sep 17 00:00:00 2001 From: ru Date: Thu, 5 Aug 1999 11:48:47 +0000 Subject: - 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 --- usr.sbin/tzsetup/tzsetup.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'usr.sbin/tzsetup') 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 @@ -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); -- cgit v1.1