aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2008-02-20 16:30:38 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2008-02-20 16:30:38 +0000
commit4543221f689a6578c15da897c45b7772926f3e05 (patch)
treec8d6a9eb790912ddc7aa120283415ae3b85c6baf /src
parent36dd35706703bfa84e3479c743209448eff7c24c (diff)
better error messages
svn path=/trunk/externals/zexy/; revision=9463
Diffstat (limited to 'src')
-rw-r--r--src/msgfile.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/msgfile.c b/src/msgfile.c
index a2901de..ac90e41 100644
--- a/src/msgfile.c
+++ b/src/msgfile.c
@@ -592,13 +592,19 @@ static void msgfile_read2(t_msgfile *x, t_symbol *filename, t_symbol *format)
break;
}
- if ((length = lseek(fd, 0, SEEK_END)) < 0 || lseek(fd, 0,SEEK_SET) < 0
- || !(readbuf = t_getbytes(length))) {
+ if ((length = lseek(fd, 0, SEEK_END)) < 0 || lseek(fd, 0,SEEK_SET) < 0) {
pd_error(x, "msgfile_read: unable to lseek %s", filnam);
close(fd);
return;
}
+ if (!(readbuf = t_getbytes(length))) {
+ pd_error(x, "msgfile_read: could not reserve %d bytes to read into", length);
+ close(fd);
+ return;
+ }
+
+
/* read */
if ((readlength = read(fd, readbuf, length)) < length) {
pd_error(x, "msgfile_read: unable to read %s", filnam);