aboutsummaryrefslogtreecommitdiff
path: root/graphics/jasper/files/patch-jas_stream.c
blob: 83bc7ca2acce4c3c67defefec49dd41766871b8e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
--- src/libjasper/base/jas_stream.c	Fri Jan 19 16:43:05 2007
+++ src/libjasper/base/jas_stream.c	Tue Jun 12 10:26:02 2007
@@ -362,13 +362,12 @@
 	obj->fd = -1;
 	obj->flags = 0;
-	obj->pathname[0] = '\0';
+	snprintf(obj->pathname, sizeof(obj->pathname), "/tmp/jasper.XXXXXX");
 	stream->obj_ = obj;
 
 	/* Choose a file name. */
-	tmpnam(obj->pathname);
+	obj->fd = mkstemp(obj->pathname);
 
 	/* Open the underlying file. */
-	if ((obj->fd = open(obj->pathname, O_CREAT | O_EXCL | O_RDWR | O_TRUNC | O_BINARY,
-	  JAS_STREAM_PERMS)) < 0) {
+	if (obj->fd < 0) {
 		jas_stream_destroy(stream);
 		return 0;