summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-07-11 15:15:40 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-07-11 15:15:40 -0400
commit965883bc223afe07ebcbb693e1108b419826d399 (patch)
tree5db0e142b37c3dc57fbd52c14b56bcecf998d533 /libs
parentef3ea6c6a647b0f885dc0f3fe4d692756a5654b4 (diff)
Use Glib functions to create tmp file path
Diffstat (limited to 'libs')
-rw-r--r--libs/gtkmm2ext/motionfeedback.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/libs/gtkmm2ext/motionfeedback.cc b/libs/gtkmm2ext/motionfeedback.cc
index 44fb3e5f47..bd0fd1cd73 100644
--- a/libs/gtkmm2ext/motionfeedback.cc
+++ b/libs/gtkmm2ext/motionfeedback.cc
@@ -468,14 +468,18 @@ Glib::RefPtr<Gdk::Pixbuf>
MotionFeedback::render_pixbuf (int size)
{
Glib::RefPtr<Gdk::Pixbuf> pixbuf;
- char path[32];
+ char *path;
int fd;
+ GError *error = NULL;
- snprintf (path, sizeof (path), "/tmp/mfimg%dXXXXXX", size);
-
- if ((fd = mkstemp (path)) < 0) {
+ fd = g_file_open_tmp ("mfimgXXXXXX", &path, &error);
+ close (fd);
+
+ if(error) {
+ g_critical("failed to open a temporary file for writing: %s.", error->message);
+ g_error_free (error);
return pixbuf;
- }
+ }
GdkColor col2 = {0,0,0,0};
GdkColor col3 = {0,0,0,0};
@@ -522,6 +526,8 @@ MotionFeedback::render_pixbuf (int size)
unlink (path);
+ g_free(path);
+
return pixbuf;
}