diff options
author | Kevin P. Fleming <kpfleming@digium.com> | 2005-10-16 23:26:35 +0000 |
---|---|---|
committer | Kevin P. Fleming <kpfleming@digium.com> | 2005-10-16 23:26:35 +0000 |
commit | 4d5c1aefb700e2537607739c699c64fdc68bdbba (patch) | |
tree | b7abefcd8790f100491f5f613cdd39faa87a74e1 /file.c | |
parent | 858e90fe57d828f64c1d2593a5fb604c47f8a092 (diff) |
minor changes and eliminate some compiler warnings
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6803 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'file.c')
-rwxr-xr-x | file.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -870,7 +870,8 @@ struct ast_filestream *ast_readfile(const char *filename, const char *type, cons 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 @@ struct ast_filestream *ast_writefile(const char *filename, const char *type, con } } - if (option_cache_record_files && fd >= 0) { + if (option_cache_record_files && (fd > -1)) { char *c; fclose(bfile); @@ -923,8 +924,9 @@ struct ast_filestream *ast_writefile(const char *filename, const char *type, con 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 @@ struct ast_filestream *ast_writefile(const char *filename, const char *type, con } } } - if (fd >= 0) { + if (fd > -1) { errno = 0; - if ((fs = f->rewrite(bfile, comment))) { fs->trans = NULL; fs->fmt = f; |