[asterisk-commits] branch 1.2 r10462 - /branches/1.2/formats/format_sln.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Feb 19 10:11:04 MST 2006


Author: tilghman
Date: Sun Feb 19 11:11:02 2006
New Revision: 10462

URL: http://svn.digium.com/view/asterisk?rev=10462&view=rev
Log:
Bug 6539 - Division by two negates error flag

Modified:
    branches/1.2/formats/format_sln.c

Modified: branches/1.2/formats/format_sln.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/formats/format_sln.c?rev=10462&r1=10461&r2=10462&view=diff
==============================================================================
--- branches/1.2/formats/format_sln.c (original)
+++ branches/1.2/formats/format_sln.c Sun Feb 19 11:11:02 2006
@@ -172,6 +172,7 @@
 static int slinear_seek(struct ast_filestream *fs, long sample_offset, int whence)
 {
 	off_t offset=0,min,cur,max;
+	int res;
 
 	min = 0;
 	sample_offset <<= 1;
@@ -189,7 +190,12 @@
 	}
 	/* always protect against seeking past begining. */
 	offset = (offset < min)?min:offset;
-	return fseek(fs->f, offset, SEEK_SET) / 2;
+	res = fseek(fs->f, offset, SEEK_SET);
+	/* Negative values indicate error */
+	if (res > -1)
+		return res / 2;
+	else
+		return res;
 }
 
 static int slinear_trunc(struct ast_filestream *fs)



More information about the asterisk-commits mailing list