[memprof: 62/76] Revert "server.c: Fix warning the use of `mktemp' is dangerous"



commit 280190e70f4a6d45d26f4efc85c505b8c806d2a4
Author: Holger Hans Peter Freyther <zecke selfish org>
Date:   Mon Jan 18 06:26:40 2010 +0100

    Revert "server.c: Fix warning the use of `mktemp' is dangerous"
    
    This is obviously breaking the unix domain socket code here. We
    only want a filename and we try to bind on this. So like the comment
    in the patch says. If someone is guessing our random name and is
    creating a socket our bind is going to fail and we will retry.
    
    This reverts commit eeb603239c1ad561b95e26481283a837790d9710.

 src/server.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/server.c b/src/server.c
index 3e10b5f..3d84869 100644
--- a/src/server.c
+++ b/src/server.c
@@ -36,7 +36,7 @@
 
 /* If USE_SOCKET_DIRECTORY is defined, then the temporary sockets will
  * be created as /tmp/memprof.UID/server.PID. Otherwise, they will
- * be created as /tmp/memprof.XXXXXX. Despite calling mkstemp(), the
+ * be created as /tmp/memprof.XXXXXX. Despite calling mktemp(), the
  * latter should be completely safe, because unix domain socket creation
  * will fail with EADDRINUSE if the file already exists.
  */
@@ -436,8 +436,8 @@ create_control_socket (MPServer *server)
 		
 #else  /* !USE_SOCKET_DIRECTORY */
 	server->socket_path = g_build_filename (g_get_tmp_dir(), SOCKET_TEMPLATE, NULL);
-	if (mkstemp (server->socket_path) == -1)
-		fatal ("mkstemp: %s\n", g_strerror (errno));
+	if (strlen(mktemp (server->socket_path)) == 0)
+		fatal ("mktemp: %s\n", g_strerror (errno));
 #endif /* USE_SOCKET_DIRECTORY */
 
 	strncpy (addr.sun_path, server->socket_path, sizeof (addr.sun_path));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]