Module Name: src Committed By: christos Date: Mon May 20 14:41:37 UTC 2024
Modified Files: src/usr.bin/tic: tic.c Log Message: PR/58270: RVP: tic does not honor the user's umask, output files are 0666. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/usr.bin/tic/tic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/tic/tic.c diff -u src/usr.bin/tic/tic.c:1.41 src/usr.bin/tic/tic.c:1.42 --- src/usr.bin/tic/tic.c:1.41 Sat May 11 18:06:57 2024 +++ src/usr.bin/tic/tic.c Mon May 20 10:41:37 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: tic.c,v 1.41 2024/05/11 22:06:57 christos Exp $ */ +/* $NetBSD: tic.c,v 1.42 2024/05/20 14:41:37 christos Exp $ */ /* * Copyright (c) 2009, 2010, 2020 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #endif #include <sys/cdefs.h> -__RCSID("$NetBSD: tic.c,v 1.41 2024/05/11 22:06:57 christos Exp $"); +__RCSID("$NetBSD: tic.c,v 1.42 2024/05/20 14:41:37 christos Exp $"); #include <sys/types.h> #include <sys/queue.h> @@ -573,6 +573,7 @@ write_database(const char *dbname) char *tmp_dbname; TERM *term; int fd; + mode_t m; db = cdbw_open(); if (db == NULL) @@ -589,7 +590,9 @@ write_database(const char *dbname) if (cdbw_output(db, fd, "NetBSD terminfo", cdbw_stable_seeder)) err(EXIT_FAILURE, "writing temporary database %s failed", tmp_dbname); - if (fchmod(fd, DEFFILEMODE)) + m = umask(0); + (void)umask(m); + if (fchmod(fd, DEFFILEMODE & ~m)) err(EXIT_FAILURE, "fchmod failed"); if (close(fd)) err(EXIT_FAILURE,