]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
add comment about opening exclusively
authorJim Meyering <jim@meyering.net>
Sun, 13 Dec 1998 19:26:35 +0000 (19:26 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 13 Dec 1998 19:26:35 +0000 (19:26 +0000)
src/sort.c
src/tac.c

index 3446abdc9d848c91fb48ae6129d5442170427ded..d6ce76d9ca3a75df0522e23c494d3e9785427607 100644 (file)
@@ -340,6 +340,8 @@ xtmpfopen (const char *file)
   FILE *fp;
   int fd;
 
+  /*  Open temporary file exclusively, to foil a common
+      denial-of-service attack.  */
   fd = open (file, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600);
   if (fd < 0 || (fp = fdopen (fd, "w")) == NULL)
     {
index 0aefe8d86ba1bb1f9acad03ee9bfbd32923ca454..06deca2e2094441af460b4311df31790337e46fa 100644 (file)
--- 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);