psppire-output_view.c: Use gnulib's clean-temp module instead of the
path_search function.
#include "gl/c-xvasprintf.h"
#include "gl/minmax.h"
#include "gl/c-xvasprintf.h"
#include "gl/minmax.h"
+#include "gl/clean-temp.h"
#include "gl/xalloc.h"
#include <gettext.h>
#include "gl/xalloc.h"
#include <gettext.h>
-/* GNU Hurd doesn't have PATH_MAX. Use a fallback.
- Temporary directory names are usually not that long. */
-#ifndef PATH_MAX
-# define PATH_MAX 1024
-#endif
-
/* Returns a pixbuf from a svg file */
/* You must unref the pixbuf after usage */
static GdkPixbuf *
/* Returns a pixbuf from a svg file */
/* You must unref the pixbuf after usage */
static GdkPixbuf *
gsize length;
gchar *text = NULL;
struct output_driver *driver = NULL;
gsize length;
gchar *text = NULL;
struct output_driver *driver = NULL;
- char dirname[PATH_MAX], *filename;
struct string_map options;
struct string_map options;
+ struct temp_dir *td = NULL;
if (view->selected_item == NULL)
return;
if (view->selected_item == NULL)
return;
- if (path_search (dirname, sizeof dirname, NULL, NULL, true)
- || mkdtemp (dirname) == NULL)
+ td = create_temp_dir ("pspp", NULL, false);
+ if (td == NULL)
{
msg_error (errno, _("failed to create temporary directory during clipboard operation"));
return;
}
{
msg_error (errno, _("failed to create temporary directory during clipboard operation"));
return;
}
- filename = xasprintf ("%s/clip.tmp", dirname);
+ filename = xasprintf ("%s/clip.tmp", td->dir_name);
string_map_init (&options);
string_map_insert (&options, "output-file", filename);
string_map_init (&options);
string_map_insert (&options, "output-file", filename);
unlink (filename);
free (filename);
unlink (filename);
free (filename);