Revision
15859
Author
anthm
Date
2009-12-09 10:16:24 -0600 (Wed, 09 Dec 2009)

Log Message

try to make the dir first so if it fails the mod fails properly

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c (15858 => 15859)


--- freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c	2009-12-09 16:06:30 UTC (rev 15858)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c	2009-12-09 16:16:24 UTC (rev 15859)
@@ -388,9 +388,14 @@
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
-	if (switch_event_bind(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+	if ((status = switch_dir_make_recursive(globals.log_dir, SWITCH_DEFAULT_DIR_PERMS, pool)) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", globals.log_dir);
+		return status;
+	}
+
+	if ((status = switch_event_bind(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL)) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
-		return SWITCH_STATUS_GENERR;
+		return status;
 	}
 
 	switch_core_add_state_handler(&state_handlers);
@@ -398,9 +403,6 @@
 
 	load_config(pool);
 
-	if ((status = switch_dir_make_recursive(globals.log_dir, SWITCH_DEFAULT_DIR_PERMS, pool)) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", globals.log_dir);
-	}
 
 	return status;
 }