Module Name: src
Committed By: martin
Date: Mon Oct 14 16:29:22 UTC 2024
Modified Files:
src/usr.bin/tic [netbsd-9]: tic.c
Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1911):
usr.bin/tic/tic.c: revision 1.42
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.31 -r1.31.6.1 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.31 src/usr.bin/tic/tic.c:1.31.6.1
--- src/usr.bin/tic/tic.c:1.31 Mon Oct 2 21:53:55 2017
+++ src/usr.bin/tic/tic.c Mon Oct 14 16:29:22 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: tic.c,v 1.31 2017/10/02 21:53:55 joerg Exp $ */
+/* $NetBSD: tic.c,v 1.31.6.1 2024/10/14 16:29:22 martin Exp $ */
/*
* Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: tic.c,v 1.31 2017/10/02 21:53:55 joerg Exp $");
+__RCSID("$NetBSD: tic.c,v 1.31.6.1 2024/10/14 16:29:22 martin Exp $");
#include <sys/types.h>
#include <sys/queue.h>
@@ -451,6 +451,7 @@ write_database(const char *dbname)
char *tmp_dbname;
TERM *term;
int fd;
+ mode_t m;
db = cdbw_open();
if (db == NULL)
@@ -465,7 +466,9 @@ write_database(const char *dbname)
err(1, "creating temporary database %s failed", tmp_dbname);
if (cdbw_output(db, fd, "NetBSD terminfo", cdbw_stable_seeder))
err(1, "writing temporary database %s failed", tmp_dbname);
- if (fchmod(fd, DEFFILEMODE))
+ m = umask(0);
+ (void)umask(m);
+ if (fchmod(fd, DEFFILEMODE & ~m))
err(1, "fchmod failed");
if (close(fd))
err(1, "writing temporary database %s failed", tmp_dbname);