I'm very pleased to announce the release of our new website and documentation using the new toolchain with Hugo and AsciiDoctor. To get more information about the new toolchain please read the FreeBSD Documentation Project Primer[1], Hugo docs[2] and AsciiDoctor docs[3]. Acknowledgment: Benedict Reuschling <bcr@> Glen Barber <gjb@> Hiroki Sato <hrs@> Li-Wen Hsu <lwhsu@> Sean Chittenden <seanc@> The FreeBSD Foundation [1] https://docs.FreeBSD.org/en/books/fdp-primer/ [2] https://gohugo.io/documentation/ [3] https://docs.asciidoctor.org/home/ Approved by: doceng, core
49 lines
1.3 KiB
Diff
49 lines
1.3 KiB
Diff
Index: sort.c
|
|
===================================================================
|
|
RCS file: /home/ncvs/src/gnu/usr.bin/sort/sort.c,v
|
|
retrieving revision 1.11
|
|
diff -u -r1.11 sort.c
|
|
--- sort.c 1998/03/06 19:00:26 1.11
|
|
+++ sort.c 2000/12/26 23:01:23
|
|
@@ -369,7 +369,7 @@
|
|
FILE *fp;
|
|
int fd;
|
|
|
|
- fd = open (file, O_EXCL | O_WRONLY | O_CREAT | O_TRUNC, 0600);
|
|
+ fd = open (file, O_WRONLY | O_CREAT | O_TRUNC, 0600);
|
|
if (fd < 0 || (fp = fdopen (fd, "w")) == NULL)
|
|
{
|
|
error (0, errno, "%s", file);
|
|
@@ -449,22 +449,24 @@
|
|
static char *
|
|
tempname (void)
|
|
{
|
|
- static unsigned int seq;
|
|
+ int fd;
|
|
int len = strlen (temp_file_prefix);
|
|
char *name = xmalloc (len + 1 + sizeof ("sort") - 1 + 5 + 5 + 1);
|
|
struct tempnode *node;
|
|
|
|
node = (struct tempnode *) xmalloc (sizeof (struct tempnode));
|
|
sprintf (name,
|
|
- "%s%ssort%5.5d%5.5d",
|
|
+ "%s%ssortXXXXXX",
|
|
temp_file_prefix,
|
|
- (len && temp_file_prefix[len - 1] != '/') ? "/" : "",
|
|
- (unsigned int) getpid () & 0xffff, seq);
|
|
+ (len && temp_file_prefix[len - 1] != '/') ? "/" : "");
|
|
|
|
- /* Make sure that SEQ's value fits in 5 digits. */
|
|
- ++seq;
|
|
- if (seq >= 100000)
|
|
- seq = 0;
|
|
+ if ((fd = mkstemp(name)) == -1)
|
|
+ {
|
|
+ error (0, errno, _("mkstemp error"));
|
|
+ cleanup ();
|
|
+ exit (2);
|
|
+ }
|
|
+ close(fd);
|
|
|
|
node->name = name;
|
|
node->next = temphead.next;
|