mkstemp() makes temp files mode 0600 so before renaming them to the

real name, fchmod to 0644.  Otherwise we end up with queue files and
the index file mode 0600 which is not the intention.

The original GNATS code makes queue files mode 0664 which seems excessively
open; 0644 should be fine.
This commit is contained in:
millert 2002-05-09 03:53:45 +00:00
parent 0c5a577ae3
commit c27643ab6f
2 changed files with 18 additions and 7 deletions

View File

@ -1,6 +1,6 @@
--- gnats/internal.c.orig Tue Mar 2 19:18:53 1999
+++ gnats/internal.c Thu Jan 11 10:56:08 2001
@@ -32,28 +32,25 @@
--- gnats/internal.c.orig Tue Mar 2 17:18:53 1999
+++ gnats/internal.c Wed May 8 21:41:29 2002
@@ -32,28 +32,25 @@ write_index (index_start)
FILE *fp;
char *path, *workfile;
@ -38,3 +38,11 @@
xfree (workfile);
return;
}
@@ -83,6 +80,7 @@ write_index (index_start)
#endif
}
+ fchmod (fileno(fp), 0644);
fclose (fp);
block_signals ();

View File

@ -1,6 +1,6 @@
--- gnats/queue-pr.c.orig Wed Nov 25 09:15:20 1998
+++ gnats/queue-pr.c Thu Jan 11 11:04:37 2001
@@ -226,13 +226,10 @@
--- gnats/queue-pr.c.orig Wed Nov 25 07:15:20 1998
+++ gnats/queue-pr.c Wed May 8 21:44:36 2002
@@ -226,13 +226,10 @@ drop_msg ()
{
int fd[2];
char *tmpdir;
@ -15,7 +15,7 @@
if (queue_file)
{
@@ -247,16 +244,10 @@
@@ -247,18 +244,13 @@ drop_msg ()
tmpdir = getenv ("TMPDIR");
if (tmpdir == NULL)
tmpdir = "/tmp"; /* FIXME */
@ -34,4 +34,7 @@
+ if ((fd[1] = mkstemp (bug_file)) < 0)
punt (1, "%s: can't open queue file %s for writing: %s\n",
program_name, bug_file, strerror (errno));
+ fchmod (fd[1], 0644);
while ((r = read (fd[0], buf, MAXBSIZE)) > 0)
if (write (fd[1], buf, r) < 0)