You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
597 B

--- a/tools/rlecat.c
+++ b/tools/rlecat.c
@@ -110,8 +110,14 @@
nflag = 0; /* Not really repeating! */
else
{
- mktemp( temp ); /* Make a temporary file name */
- tmpfile = rle_open_f( cmd_name( argv ), temp, "w+" );
+ /* we dont have to use rle_open_f() because all it does in
+ * this case is run fopen() ... we're creating a file so all
+ * the checks for opening an existing file aren't needed */
+ int fd = mkstemp(temp);
+ if (fd == -1 || (tmpfile = fdopen(fd, "w+")) == NULL) {
+ perror("Unable to open tempfile");
+ exit(-1);
+ }
}
}