summaryrefslogtreecommitdiff
path: root/src/tac.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-12-13 19:26:35 +0000
committerJim Meyering <jim@meyering.net>1998-12-13 19:26:35 +0000
commit7dfd5ca1cd8db43dae50c6f0a5d3038bcc6a0a5f (patch)
treeec3bec2435b59d9625e1fc149b835520b8198eba /src/tac.c
parentc5195207dba0429aede01fe0b9395f4a261ff9c2 (diff)
downloadcoreutils-7dfd5ca1cd8db43dae50c6f0a5d3038bcc6a0a5f.tar.xz
add comment about opening exclusively
Diffstat (limited to 'src/tac.c')
-rw-r--r--src/tac.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/tac.c b/src/tac.c
index 0aefe8d86..06deca2e2 100644
--- a/src/tac.c
+++ b/src/tac.c
@@ -394,6 +394,8 @@ save_stdin (FILE **g_tmp, char **g_tempfile)
sprintf (template, "%s/tacXXXXXX", tempdir);
tempfile = mktemp (template);
+ /* Open temporary file exclusively, to foil a common
+ denial-of-service attack. */
fd = open (tempfile, O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600);
if (fd == -1)
error (EXIT_FAILURE, errno, "%s", tempfile);