Mercurial > trustbridge
comparison cinst/main.c @ 667:fb69aef056ea
Be more verbose in error logging
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 26 Jun 2014 17:41:53 +0200 |
parents | f595fcbe3e76 |
children | 698b6a9bd75e |
comparison
equal
deleted
inserted
replaced
666:d905758aa3a6 | 667:fb69aef056ea |
---|---|
88 return -1; | 88 return -1; |
89 } | 89 } |
90 | 90 |
91 f = fopen (file_name, "rb"); | 91 f = fopen (file_name, "rb"); |
92 if (f == NULL) | 92 if (f == NULL) |
93 return ERR_NO_INSTRUCTIONS; | 93 { |
94 ERRORPRINTF ("Failed to open file: %s\n", file_name); | |
95 return ERR_NO_INSTRUCTIONS; | |
96 } | |
94 | 97 |
95 fseek (f, 0, SEEK_END); | 98 fseek (f, 0, SEEK_END); |
96 file_size = ftell (f); | 99 file_size = ftell (f); |
97 if (file_size <= 0) | 100 if (file_size <= 0) |
98 { | 101 { |
99 fclose (f); | 102 fclose (f); |
103 ERRORPRINTF ("File size error: %s\n", file_name); | |
100 return ERR_NO_INSTRUCTIONS; | 104 return ERR_NO_INSTRUCTIONS; |
101 } | 105 } |
102 | 106 |
103 fseek (f, 0, SEEK_SET); | 107 fseek (f, 0, SEEK_SET); |
104 | 108 |
105 if (file_size + 1 == 0) | 109 if (file_size + 1 == 0) |
106 { | 110 { |
107 fclose (f); | 111 fclose (f); |
112 ERRORPRINTF ("File seek error: %s\n", file_name); | |
108 return ERR_INVALID_INSTRUCTIONS; | 113 return ERR_INVALID_INSTRUCTIONS; |
109 } | 114 } |
110 | 115 |
111 while (fgets (buf, MAX_LINE_LENGTH + 1, f) ) | 116 while (fgets (buf, MAX_LINE_LENGTH + 1, f) ) |
112 { | 117 { |