summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-03-11 11:53:29 +0000
committerJim Meyering <jim@meyering.net>1998-03-11 11:53:29 +0000
commit7ee8ed7e378e2a5a9495bc17692fc41f266c14ac (patch)
treede0f5073319488a5ee7385e0b861aa0a4f355c31 /src
parenta991132f3ecd9befe801c25901617c3cf1d7e70b (diff)
downloadcoreutils-7ee8ed7e378e2a5a9495bc17692fc41f266c14ac.tar.xz
(xtmpfopen): Open temporary file exclusively, to
foil a common denial-of-service attack. From Paul Eggert.
Diffstat (limited to 'src')
-rw-r--r--src/sort.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sort.c b/src/sort.c
index cbcbff1e7..fd1f4d0a0 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -346,7 +346,7 @@ xtmpfopen (const char *file)
FILE *fp;
int fd;
- fd = open (file, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+ fd = open (file, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600);
if (fd < 0 || (fp = fdopen (fd, "w")) == NULL)
{
error (0, errno, "%s", file);