[asterisk-commits] jpeeler: branch jpeeler/manager-configactions r102964 - /team/jpeeler/manager...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 7 18:48:16 CST 2008


Author: jpeeler
Date: Thu Feb  7 18:48:15 2008
New Revision: 102964

URL: http://svn.digium.com/view/asterisk?view=rev&rev=102964
Log:
explicit return codes used

Modified:
    team/jpeeler/manager-configactions/main/config.c
    team/jpeeler/manager-configactions/main/manager.c

Modified: team/jpeeler/manager-configactions/main/config.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/manager-configactions/main/config.c?view=diff&rev=102964&r1=102963&r2=102964
==============================================================================
--- team/jpeeler/manager-configactions/main/config.c (original)
+++ team/jpeeler/manager-configactions/main/config.c Thu Feb  7 18:48:15 2008
@@ -360,7 +360,7 @@
 	int lineno;
 	int insertline;
 
-	if (!variable || !sscanf(line, "%d", &insertline))
+	if (!variable || sscanf(line, "%d", &insertline) != 1)
 		return;
 	if (atoi(line) == 0) {
 		variable->next = category->root;

Modified: team/jpeeler/manager-configactions/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/manager-configactions/main/manager.c?view=diff&rev=102964&r1=102963&r2=102964
==============================================================================
--- team/jpeeler/manager-configactions/main/manager.c (original)
+++ team/jpeeler/manager-configactions/main/manager.c Thu Feb  7 18:48:15 2008
@@ -1422,11 +1422,11 @@
 	ast_str_set(&filepath, 0, "%s/", ast_config_AST_CONFIG_DIR);
 	ast_str_append(&filepath, 0, "%s", fn);
 
-	if ((fd = open(filepath->str, O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP| S_IROTH)) > 0) {
+	if ((fd = open(filepath->str, O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP| S_IROTH)) != -1) {
 		close(fd);
 		astman_send_ack(s, m, "New configuration file created successfully");
 	} else 
-		astman_send_error(s, m, "Configuration file already exists");
+		astman_send_error(s, m, strerror(errno));
 
 	return 0;
 }




More information about the asterisk-commits mailing list