about summary refs log tree commit diff
path: root/lib/pmfileio.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-06-30 03:27:10 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-06-30 03:27:10 +0000
commit08d938dc6fc6b30e5da6733b52c97169c0d24f8a (patch)
tree92673cd6a5755fc209078cc6b6a42602defc0212 /lib/pmfileio.c
parente21f4e95d897c93a4779bf78c71f1341d164a222 (diff)
downloadnetpbm-mirror-08d938dc6fc6b30e5da6733b52c97169c0d24f8a.tar.gz
netpbm-mirror-08d938dc6fc6b30e5da6733b52c97169c0d24f8a.tar.xz
netpbm-mirror-08d938dc6fc6b30e5da6733b52c97169c0d24f8a.zip
Copy Development as new Advanced
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@3018 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib/pmfileio.c')
-rw-r--r--lib/pmfileio.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/pmfileio.c b/lib/pmfileio.c
index 035037ba..cfdac10d 100644
--- a/lib/pmfileio.c
+++ b/lib/pmfileio.c
@@ -774,11 +774,18 @@ pm_readmagicnumber(FILE * const ifP) {
     int ich1, ich2;
 
     ich1 = getc(ifP);
+
+    if (ich1 == EOF)
+        pm_error("Error reading first byte of what is expected to be "
+                 "a Netpbm magic number.  "
+                 "Most often, this means your input file is empty");
+
     ich2 = getc(ifP);
-    if (ich1 == EOF || ich2 == EOF)
-        pm_error( "Error reading magic number from Netpbm image stream.  "
-                  "Most often, this "
-                  "means your input file is empty." );
+
+    if (ich2 == EOF)
+        pm_error("Error reading second byte of what is expected to be "
+                 "a Netpbm magic number (the first byte was successfully "
+                 "read as 0x%02x)", ich1);
 
     return ich1 * 256 + ich2;
 }