From 1b089bc2fa36fdbd69af25a15ec5ee3e8963b80d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bert=20M=C3=BCnnich?= <ber.t@posteo.de>
Date: Sat, 5 Oct 2013 17:37:00 +0200
Subject: [PATCH] Seek over EXIF APP0 frame instead of reading and discarding
 it

---
 Makefile | 2 +-
 exif.c   | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 58a9adc..ae4586f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION = git-20130907
+VERSION = git-20131005
 
 PREFIX    = /usr/local
 MANPREFIX = $(PREFIX)/share/man
diff --git a/exif.c b/exif.c
index 098fa72..424d36d 100644
--- a/exif.c
+++ b/exif.c
@@ -79,9 +79,10 @@ int exif_orientation(const fileinfo_t *file)
 		goto abort;
 	if (s_read(fd, file->name, data, 4) < 0)
 		goto abort;
-	if (btous(data, order) == JPEG_MARKER_APP0){
+
+	if (btous(data, order) == JPEG_MARKER_APP0) {
 		len = btous(data + 2, order);
-		if (s_read(fd, file->name, data, len - 2) < 0)
+		if (lseek(fd, len - 2, SEEK_CUR) == (off_t) -1)
 			goto abort;
 		if (s_read(fd, file->name, data, 4) < 0)
 			goto abort;