[asterisk-commits] seanbright: branch 1.6.0 r129865 - in /branches/1.6.0: ./ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 10 20:01:39 CDT 2008


Author: seanbright
Date: Thu Jul 10 20:01:39 2008
New Revision: 129865

URL: http://svn.digium.com/view/asterisk?view=rev&rev=129865
Log:
Merged revisions 129864 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r129864 | seanbright | 2008-07-10 20:55:06 -0400 (Thu, 10 Jul 2008) | 1 line

Fix some usages of snprintf, and clarify a couple variable names.
........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/res/res_config_ldap.c
    branches/1.6.0/res/res_config_pgsql.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/res/res_config_ldap.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/res/res_config_ldap.c?view=diff&rev=129865&r1=129864&r2=129865
==============================================================================
--- branches/1.6.0/res/res_config_ldap.c (original)
+++ branches/1.6.0/res/res_config_ldap.c Thu Jul 10 20:01:39 2008
@@ -1525,7 +1525,7 @@
 
 static char *realtime_ldap_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
-	char status[256], status2[100] = "";
+	char status[256], credentials[100] = "";
 	int ctime = time(NULL) - connect_time;
 
 	switch (cmd) {
@@ -1546,26 +1546,26 @@
 		snprintf(status, sizeof(status), "Connected to '%s', baseDN %s", url, basedn);
 
 	if (!ast_strlen_zero(user))
-		snprintf(status2, sizeof(status2), " with username %s", user);
+		snprintf(credentials, sizeof(credentials), " with username %s", user);
 
 	if (ctime > 31536000) {
 		ast_cli(a->fd, "%s%s for %d years, %d days, %d hours, %d minutes, %d seconds.\n",
-				status, status2, ctime / 31536000,
+				status, credentials, ctime / 31536000,
 				(ctime % 31536000) / 86400, (ctime % 86400) / 3600,
 				(ctime % 3600) / 60, ctime % 60);
 	} else if (ctime > 86400) {
 		ast_cli(a->fd, "%s%s for %d days, %d hours, %d minutes, %d seconds.\n",
-				status, status2, ctime / 86400, (ctime % 86400) / 3600,
+				status, credentials, ctime / 86400, (ctime % 86400) / 3600,
 				(ctime % 3600) / 60, ctime % 60);
 	} else if (ctime > 3600) {
 		ast_cli(a->fd, "%s%s for %d hours, %d minutes, %d seconds.\n",
-				status, status2, ctime / 3600, (ctime % 3600) / 60,
+				status, credentials, ctime / 3600, (ctime % 3600) / 60,
 				ctime % 60);
 	} else if (ctime > 60) {
-		ast_cli(a->fd, "%s%s for %d minutes, %d seconds.\n", status, status2,
+		ast_cli(a->fd, "%s%s for %d minutes, %d seconds.\n", status, credentials,
 					ctime / 60, ctime % 60);
 	} else {
-		ast_cli(a->fd, "%s%s for %d seconds.\n", status, status2, ctime);
+		ast_cli(a->fd, "%s%s for %d seconds.\n", status, credentials, ctime);
 	}
 
 	return CLI_SUCCESS;

Modified: branches/1.6.0/res/res_config_pgsql.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/res/res_config_pgsql.c?view=diff&rev=129865&r1=129864&r2=129865
==============================================================================
--- branches/1.6.0/res/res_config_pgsql.c (original)
+++ branches/1.6.0/res/res_config_pgsql.c Thu Jul 10 20:01:39 2008
@@ -945,7 +945,7 @@
 
 static char *handle_cli_realtime_pgsql_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
-	char status[256], status2[100] = "";
+	char status[256], credentials[100] = "";
 	int ctime = time(NULL) - connect_time;
 
 	switch (cmd) {
@@ -964,31 +964,31 @@
 
 	if (pgsqlConn && PQstatus(pgsqlConn) == CONNECTION_OK) {
 		if (!ast_strlen_zero(dbhost))
-			snprintf(status, 255, "Connected to %s@%s, port %d", dbname, dbhost, dbport);
+			snprintf(status, sizeof(status), "Connected to %s@%s, port %d", dbname, dbhost, dbport);
 		else if (!ast_strlen_zero(dbsock))
-			snprintf(status, 255, "Connected to %s on socket file %s", dbname, dbsock);
+			snprintf(status, sizeof(status), "Connected to %s on socket file %s", dbname, dbsock);
 		else
-			snprintf(status, 255, "Connected to %s@%s", dbname, dbhost);
+			snprintf(status, sizeof(status), "Connected to %s@%s", dbname, dbhost);
 
 		if (!ast_strlen_zero(dbuser))
-			snprintf(status2, 99, " with username %s", dbuser);
+			snprintf(credentials, sizeof(credentials), " with username %s", dbuser);
 
 		if (ctime > 31536000)
 			ast_cli(a->fd, "%s%s for %d years, %d days, %d hours, %d minutes, %d seconds.\n",
-					status, status2, ctime / 31536000, (ctime % 31536000) / 86400,
+					status, credentials, ctime / 31536000, (ctime % 31536000) / 86400,
 					(ctime % 86400) / 3600, (ctime % 3600) / 60, ctime % 60);
 		else if (ctime > 86400)
 			ast_cli(a->fd, "%s%s for %d days, %d hours, %d minutes, %d seconds.\n", status,
-					status2, ctime / 86400, (ctime % 86400) / 3600, (ctime % 3600) / 60,
+					credentials, ctime / 86400, (ctime % 86400) / 3600, (ctime % 3600) / 60,
 					ctime % 60);
 		else if (ctime > 3600)
-			ast_cli(a->fd, "%s%s for %d hours, %d minutes, %d seconds.\n", status, status2,
+			ast_cli(a->fd, "%s%s for %d hours, %d minutes, %d seconds.\n", status, credentials,
 					ctime / 3600, (ctime % 3600) / 60, ctime % 60);
 		else if (ctime > 60)
-			ast_cli(a->fd, "%s%s for %d minutes, %d seconds.\n", status, status2, ctime / 60,
+			ast_cli(a->fd, "%s%s for %d minutes, %d seconds.\n", status, credentials, ctime / 60,
 					ctime % 60);
 		else
-			ast_cli(a->fd, "%s%s for %d seconds.\n", status, status2, ctime);
+			ast_cli(a->fd, "%s%s for %d seconds.\n", status, credentials, ctime);
 
 		return CLI_SUCCESS;
 	} else {




More information about the asterisk-commits mailing list