From b6b5fd6da79aff13f7ebded1ae49124743411271 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Mon, 16 May 2016 05:35:22 +0200 Subject: [PATCH] jpg: output partial image data when available (truncated files) --- sys/src/cmd/jpg/readjpg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/src/cmd/jpg/readjpg.c b/sys/src/cmd/jpg/readjpg.c index c6df3ecea..942b581e9 100644 --- a/sys/src/cmd/jpg/readjpg.c +++ b/sys/src/cmd/jpg/readjpg.c @@ -226,9 +226,9 @@ jpgerror(Header *h, char *fmt, ...) va_start(arg, fmt); vseprint(h->err, h->err+sizeof h->err, fmt, arg); va_end(arg); - + if(h->image != nil) + fprint(2, "jpg: partial image: %s\n", h->err); werrstr("%s", h->err); - jpgfreeall(h, 1); longjmp(h->errlab, 1); } @@ -258,7 +258,7 @@ Breadjpg(Biobuf *b, int colorspace) h->fd = b; errstr(buf, sizeof buf); /* throw it away */ if(setjmp(h->errlab)) - r = nil; + r = h->image; else r = readslave(h, colorspace); jpgfreeall(h, 0);