[asterisk-commits] file: branch 1.4 r57870 - in /branches/1.4: ./ apps/app_voicemail.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Mar 5 10:52:03 MST 2007


Author: file
Date: Mon Mar  5 11:52:03 2007
New Revision: 57870

URL: http://svn.digium.com/view/asterisk?view=rev&rev=57870
Log:
Merged revisions 57869 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r57869 | file | 2007-03-05 12:49:18 -0500 (Mon, 05 Mar 2007) | 2 lines

Make create_dirpath use our standard for return values. -1 is failure, 0 is success. (issue #9205 reported by ballares)

........

Modified:
    branches/1.4/   (props changed)
    branches/1.4/apps/app_voicemail.c

Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: branches/1.4/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_voicemail.c?view=diff&rev=57870&r1=57869&r2=57870
==============================================================================
--- branches/1.4/apps/app_voicemail.c (original)
+++ branches/1.4/apps/app_voicemail.c Mon Mar  5 11:52:03 2007
@@ -898,7 +898,7 @@
  * \param context String. Ignored if is null or empty string.
  * \param ext     String. Ignored if is null or empty string.
  * \param folder  String. Ignored if is null or empty string. 
- * \return 0 on failure, 1 on success.
+ * \return -1 on failure, 0 on success.
  */
 static int create_dirpath(char *dest, int len, const char *context, const char *ext, const char *folder)
 {
@@ -908,24 +908,24 @@
 		make_dir(dest, len, context, "", "");
 		if (mkdir(dest, mode) && errno != EEXIST) {
 			ast_log(LOG_WARNING, "mkdir '%s' failed: %s\n", dest, strerror(errno));
-			return 0;
+			return -1;
 		}
 	}
 	if (!ast_strlen_zero(ext)) {
 		make_dir(dest, len, context, ext, "");
 		if (mkdir(dest, mode) && errno != EEXIST) {
 			ast_log(LOG_WARNING, "mkdir '%s' failed: %s\n", dest, strerror(errno));
-			return 0;
+			return -1;
 		}
 	}
 	if (!ast_strlen_zero(folder)) {
 		make_dir(dest, len, context, ext, folder);
 		if (mkdir(dest, mode) && errno != EEXIST) {
 			ast_log(LOG_WARNING, "mkdir '%s' failed: %s\n", dest, strerror(errno));
-			return 0;
-		}
-	}
-	return 1;
+			return -1;
+		}
+	}
+	return 0;
 }
 
 /* only return failure if ast_lock_path returns 'timeout',
@@ -2132,7 +2132,7 @@
 
 	snprintf(fn, sizeof(fn), "%s%s/%s/greet", VM_SPOOL_DIR, context, ext);
 
-	if (!(res = create_dirpath(dest, sizeof(dest), context, ext, "greet"))) {
+	if ((res = create_dirpath(dest, sizeof(dest), context, ext, "greet"))) {
 		ast_log(LOG_WARNING, "Failed to make directory(%s)\n", fn);
 		return -1;
 	}
@@ -2870,7 +2870,7 @@
 		snprintf(prefile, sizeof(prefile), "%s%s/%s/unavail", VM_SPOOL_DIR, vmu->context, ext);
 	}
 	snprintf(tempfile, sizeof(tempfile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, ext);
-	if (!(res = create_dirpath(dest, sizeof(dest), vmu->context, ext, "temp"))) {
+	if ((res = create_dirpath(dest, sizeof(dest), vmu->context, ext, "temp"))) {
 		ast_log(LOG_WARNING, "Failed to make directory (%s)\n", tempfile);
 		return -1;
 	}
@@ -5923,7 +5923,7 @@
 	}
 
 	snprintf(prefile, sizeof(prefile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, vms->username);
-	if (!(res = create_dirpath(dest, sizeof(dest), vmu->context, vms->username, "temp"))) {
+	if ((res = create_dirpath(dest, sizeof(dest), vmu->context, vms->username, "temp"))) {
 		ast_log(LOG_WARNING, "Failed to create directory (%s).\n", prefile);
 		return -1;
 	}



More information about the asterisk-commits mailing list