13
0

Use Glib functions to create tmp file path

This commit is contained in:
Paul Davis 2013-07-11 15:15:40 -04:00
parent ef3ea6c6a6
commit 965883bc22

View File

@ -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);
fd = g_file_open_tmp ("mfimgXXXXXX", &path, &error);
close (fd);
if ((fd = mkstemp (path)) < 0) {
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;
}