X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fcasefile.c;h=fdf033cbae672c7ae29135dd7d2cb62c8f0031a2;hb=067d02c2b8c591efc368cf5127c497313d7a373f;hp=eca07f83e2610fcdb499372e661209dbb764e67b;hpb=cb962ee9edc95f73507d35f0714ec8aa68c5295c;p=pspp diff --git a/src/casefile.c b/src/casefile.c index eca07f83e2..fdf033cbae 100644 --- a/src/casefile.c +++ b/src/casefile.c @@ -339,35 +339,6 @@ flush_buffer (struct casefile *cf) } } -/* 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; -} /* If CF is currently stored in memory, writes it to disk. Readers, if any, retain their current positions. */ @@ -726,6 +697,7 @@ full_write (int fd, const void *buffer_, size_t size) return bytes_written; } + /* Registers our exit handler with atexit() if it has not already been registered. */ static void @@ -739,6 +711,8 @@ register_atexit (void) } } + + /* atexit() handler that closes and deletes our temporary files. */ static void