Blob Blame History Raw
--- trunk/plug-ins/compiz-icon/src/applet-notifications.c.tmpuse	2008-06-15 02:04:01.000000000 +0900
+++ trunk/plug-ins/compiz-icon/src/applet-notifications.c	2008-06-15 20:51:54.000000000 +0900
@@ -8,6 +8,8 @@
 
 ******************************************************************************/
 
+#define _BSD_SOURCE
+#include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
 #include <glib/gi18n.h>
@@ -23,13 +25,26 @@
 CD_APPLET_ABOUT (D_("This is the compiz-icon applet\n made by ChAnGFu for Cairo-Dock"))
 
 static void _compiz_get_version (void) {
+	char *tmpfile = g_strdup("/tmp/cd-compiz-version.XXXXXX");
+	char *cmd_header = "compiz.real --version | awk '{print $2}' > ";
+	char *cmd = g_malloc(strlen(cmd_header) + strlen(tmpfile) + 2);
+	int fds = mkstemp(tmpfile);
+	if (fds == -1) {
+		free (tmpfile);
+		free (cmd);
+		return;
+	}
+	close(fds);
+
 	if (myData.iCompizMajor != 0 || myData.iCompizMinor != 0 || myData.iCompizMicro != 0)
 		return ;
-	system ("compiz.real --version | awk '{print $2}' > /tmp/cd-compiz-version");
+	sprintf(cmd, "%s%s", cmd_header, tmpfile);
+	system (cmd);
+	g_free (cmd);
 	GError *erreur = NULL;
 	gsize length = 0;
 	gchar *cContent = NULL;
-	g_file_get_contents ("/tmp/cd-compiz-version", &cContent, &length, &erreur);
+	g_file_get_contents (tmpfile, &cContent, &length, &erreur);
 	if (erreur != NULL) {
 		cd_warning ("Attention : couldn't guess Compiz's version [%s]", erreur->message);
 		g_error_free (erreur);
@@ -40,7 +55,9 @@
 		g_free (cContent);
 	}
 	cd_message ("Compiz : %d.%d.%d", myData.iCompizMajor, myData.iCompizMinor, myData.iCompizMicro);
-	g_remove ("/tmp/cd-compiz-version");
+	g_remove (tmpfile);
+	g_free (tmpfile);
+	tmpfile = NULL;
 }
 
 static void _compiz_dbus_action (const gchar *cCommand) {
--- trunk/plug-ins/nVidia/src/applet-nvidia.c.tmpuse	2008-06-15 12:37:12.000000000 +0900
+++ trunk/plug-ins/nVidia/src/applet-nvidia.c	2008-06-15 21:15:21.000000000 +0900
@@ -100,6 +100,7 @@
 	gchar *cCommand = g_strdup_printf ("bash %s/nvidia-config %s", MY_APPLET_SHARE_DATA_DIR, s_cTmpFileConfig);
 	system (cCommand);
 	g_free (cCommand);
+	close(fds);
 }
 
 static gboolean _nvidia_get_values_from_file (gchar *cContent) {