~ubuntu-branches/ubuntu/karmic/grace/karmic

« back to all changes in this revision

Viewing changes to debian/patches/tmpnam_to_mkstemp.diff

  • Committer: Bazaar Package Importer
  • Author(s): Ionut Georgescu
  • Date: 2006-11-12 17:58:47 UTC
  • mfrom: (2.1.6 feisty)
  • Revision ID: james.westby@ubuntu.com-20061112175847-pwerjj6k1smuwp6f
Tags: 1:5.1.20-5
Fix a bug in grace-thumbnailer which makes it write the thumbnail to
stdout instead of the destination supplied by nautilus.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
=== src/plotone.c
 
2
==================================================================
 
3
--- src/plotone.c       (revision 309)
 
4
+++ src/plotone.c       (revision 312)
 
5
@@ -121,18 +121,28 @@
 
6
             sprintf(print_file, "%s.%s", get_docbname(), dev.fext);
 
7
         }
 
8
         strcpy(fname, print_file);
 
9
+        prstream = grace_openw(fname);
 
10
     } else {
 
11
+        int hdfd;
 
12
+
 
13
         s = get_print_cmd();
 
14
         if (s == NULL || s[0] == '\0') {
 
15
             errmsg("No print command defined, output aborted");
 
16
             return;
 
17
         }
 
18
-        tmpnam(fname);
 
19
-        /* VMS doesn't like extensionless files */
 
20
-        strcat(fname, ".prn");
 
21
+       strcpy(fname, "grace-hardcopy-XXXXXX");
 
22
+        hdfd=mkstemp(fname);
 
23
+       if (hdfd == -1) {
 
24
+               errmsg("Could not create a temporary file, output aborted.");
 
25
+               return;
 
26
+       }
 
27
+       prstream = fdopen(hdfd, "wb");
 
28
+       if (prstream == NULL) {
 
29
+               errmsg("Could not create a temporary file, output aborted.");
 
30
+               return;
 
31
+       }
 
32
     }
 
33
     
 
34
-    prstream = grace_openw(fname);
 
35
     
 
36
     if (prstream == NULL) {
 
37
         return;
 
38
=== src/editpwin.c
 
39
==================================================================
 
40
--- src/editpwin.c      (revision 309)
 
41
+++ src/editpwin.c      (revision 312)
 
42
@@ -776,12 +776,12 @@
 
43
  */
 
44
 void do_ext_editor(int gno, int setno)
 
45
 {
 
46
-    char *fname, ebuf[256];
 
47
+    char fname[64], ebuf[256];
 
48
     FILE *cp;
 
49
     int save_autos;
 
50
 
 
51
-    fname = tmpnam(NULL);
 
52
-    cp = grace_openw(fname);
 
53
+    strcpy(fname, "grace-XXXXXX");
 
54
+    cp = fdopen(mkstemp(fname), "wb");
 
55
     if (cp == NULL) {
 
56
         return;
 
57
     }