1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-25 07:00:43 +00:00
nixpkgs/pkgs/development/libraries/urt/urt-3.1b-tempfile.patch
Evgeny Egorochkin 5a4bc5b072 URT library: packaged
svn path=/nixpkgs/trunk/; revision=24278
2010-10-14 11:54:06 +00:00

20 lines
593 B
Diff

--- tools/rlecat.c
+++ 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);
+ }
}
}