[Asterisk-cvs] asterisk file.c,1.77,1.78

kpfleming kpfleming
Sun Oct 16 19:32:30 CDT 2005


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv25641

Modified Files:
	file.c 
Log Message:
minor changes and eliminate some compiler warnings


Index: file.c
===================================================================
RCS file: /usr/cvsroot/asterisk/file.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- file.c	16 Oct 2005 16:12:51 -0000	1.77
+++ file.c	16 Oct 2005 23:26:35 -0000	1.78
@@ -870,7 +870,8 @@
 struct ast_filestream *ast_writefile(const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode)
 {
 	int fd, myflags = 0;
-	FILE *bfile;
+	/* compiler claims this variable can be used before initialization... */
+	FILE *bfile = NULL;
 	struct ast_format *f;
 	struct ast_filestream *fs = NULL;
 	char *fn, *orig_fn = NULL;
@@ -908,7 +909,7 @@
 			}
 		}
 		
-		if (option_cache_record_files && fd >= 0) {
+		if (option_cache_record_files && (fd > -1)) {
 			char *c;
 
 			fclose(bfile);
@@ -923,8 +924,9 @@
 
 			size = strlen(fn) + strlen(record_cache_dir) + 2;
 			buf = alloca(size);
-			memset(buf, 0, size);
-			snprintf(buf, size, "%s/%s", record_cache_dir, fn);
+			strcpy(buf, record_cache_dir);
+			strcat(buf, "/");
+			strcat(buf, fn);
 			free(fn);
 			fn = buf;
 			fd = open(fn, flags | myflags, mode);
@@ -938,9 +940,8 @@
 				}
 			}
 		}
-		if (fd >= 0) {
+		if (fd > -1) {
 			errno = 0;
-
 			if ((fs = f->rewrite(bfile, comment))) {
 				fs->trans = NULL;
 				fs->fmt = f;




More information about the svn-commits mailing list