[svn-commits] rizzo: trunk r45598 - /trunk/main/manager.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Wed Oct 18 14:36:21 MST 2006


Author: rizzo
Date: Wed Oct 18 16:36:20 2006
New Revision: 45598

URL: http://svn.digium.com/view/asterisk?rev=45598&view=rev
Log:
ouch! remember to unlink temporary files once done with them.


Modified:
    trunk/main/manager.c

Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?rev=45598&r1=45597&r2=45598&view=diff
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Wed Oct 18 16:36:20 2006
@@ -2413,6 +2413,7 @@
 	char *retval = NULL;
 	struct message m;
 	struct ast_variable *v;
+	char template[] = "/tmp/ast-http-XXXXXX";	/* template for temporary file */
 
 	for (v = params; v; v = v->next) {
 		if (!strcasecmp(v->name, "mansession_id")) {
@@ -2477,11 +2478,9 @@
 		ast_build_string(&c, &len, ROW_FMT, "<h1>Manager Tester</h1>");
 		ast_build_string(&c, &len, ROW_FMT, TEST_STRING);
 	}
-	{
-		char template[32];
-		ast_copy_string(template, "/tmp/ast-http-XXXXXX", sizeof(template));
-		s->fd = mkstemp(template);
-	}
+
+	s->fd = mkstemp(template);	/* create a temporary file for command output */
+
 	if (process_message(s, &m)) {
 		if (s->authenticated) {
 			if (option_verbose > 1) {
@@ -2515,6 +2514,7 @@
 		}
 		close(s->fd);
 		s->fd = -1;
+		unlink(template);
 	}
 
 	if (s->outputstr) {



More information about the svn-commits mailing list