/[pspp]/pspp/src/casefile.c
ViewVC logotype

Diff of /pspp/src/casefile.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by jmd, Thu Jan 13 13:02:26 2005 UTC revision 1.11 by jmd, Fri Jan 14 04:05:47 2005 UTC
# Line 339  flush_buffer (struct casefile *cf) Line 339  flush_buffer (struct casefile *cf)
339      }      }
340  }  }
341    
 /* Creates a temporary file and stores its name in *FILENAME and  
    a file descriptor for it in *FD.  Returns success.  Caller is  
    responsible for freeing *FILENAME. */  
 static int  
 make_temp_file (int *fd, char **filename)  
 {  
   const char *parent_dir;  
   
   assert (filename != NULL);  
   assert (fd != NULL);  
   
   if (getenv ("TMPDIR") != NULL)  
     parent_dir = getenv ("TMPDIR");  
   else  
     parent_dir = P_tmpdir;  
   
   *filename = xmalloc (strlen (parent_dir) + 32);  
   sprintf (*filename, "%s%cpsppXXXXXX", parent_dir, DIR_SEPARATOR);  
   *fd = mkstemp (*filename);  
   if (*fd < 0)  
     {  
       msg (FE, _("%s: Creating temporary file: %s."),  
            *filename, strerror (errno));  
       free (*filename);  
       *filename = NULL;  
       return 0;  
     }  
   return 1;  
 }  
342    
343  /* If CF is currently stored in memory, writes it to disk.  Readers, if any,  /* If CF is currently stored in memory, writes it to disk.  Readers, if any,
344     retain their current positions. */     retain their current positions. */

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26