Mercurial > hg > octave-image
changeset 605:764d78294156
readexif: check input and proper error check after fopen
author | carandraug |
---|---|
date | Mon, 24 Sep 2012 13:55:19 +0000 |
parents | b45189bda253 |
children | 20f20769cd9f |
files | inst/readexif.m |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/inst/readexif.m +++ b/inst/readexif.m @@ -36,13 +36,17 @@ function exif = readexif(file, thumbnail) + if (nargin < 1 || nargin > 2) + print_usage; + endif + % Enable the debug flag to see more of the JPG sections. debug = false; - in = fopen(file); + [in, msg] = fopen(file); if (in<0) - error('File "%s" not found !', file); + error ("readexif: could not open `%s': %s", file, msg); end s = fread(in, 1, 'uint16', 'ieee-be');