summaryrefslogtreecommitdiff
path: root/funcs
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2010-09-30 20:40:08 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2010-09-30 20:40:08 +0000
commit6d0e38332157bad2ad3c3667cd80c214e47fb83a (patch)
treefa98c6c19dbadcf2986ba059b1d090a07d8b1044 /funcs
parent72fbcfd95d3f10f3ce78282760856e7b3ce7f48d (diff)
Merged revisions 289543,289581 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r289543 | tilghman | 2010-09-30 12:50:52 -0500 (Thu, 30 Sep 2010) | 2 lines More Solaris compatibility fixes ........ r289581 | tilghman | 2010-09-30 15:23:10 -0500 (Thu, 30 Sep 2010) | 2 lines Solaris fixes. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@289588 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_env.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/funcs/func_env.c b/funcs/func_env.c
index 6a3642a44..736095290 100644
--- a/funcs/func_env.c
+++ b/funcs/func_env.c
@@ -788,7 +788,7 @@ static int file_write(struct ast_channel *chan, const char *cmd, char *data, con
fseeko(ff, offset, SEEK_SET);
ast_debug(3, "offset=%s/%" PRId64 ", length=%s/%" PRId64 ", vlength=%" PRId64 ", flength=%" PRId64 "\n",
- args.offset, offset, args.length, length, vlength, flength);
+ S_OR(args.offset, "(null)"), offset, S_OR(args.length, "(null)"), length, vlength, flength);
if (length == vlength) {
/* Simplest case, a straight replace */
@@ -821,6 +821,11 @@ static int file_write(struct ast_channel *chan, const char *cmd, char *data, con
if (fwrite(fbuf, 1, sizeof(fbuf), ff) < sizeof(fbuf)) {
ast_log(LOG_ERROR, "Short write?!!\n");
}
+ /* Seek to where we stopped reading */
+ if (fseeko(ff, cur + sizeof(fbuf), SEEK_SET) < 0) {
+ /* Only reason for seek to fail is EOF */
+ break;
+ }
}
fclose(ff);
if (truncate(args.filename, flength - (length - vlength))) {