summaryrefslogtreecommitdiff
path: root/ndisasm.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2002-04-30 20:53:16 +0000
committerH. Peter Anvin <hpa@zytor.com>2002-04-30 20:53:16 +0000
commit87bc61964cf5d2cc2e322883d6f927a43fb53af3 (patch)
treecf5f2e9602092902807762c09912a5e520121368 /ndisasm.c
parent76690a12ad212d1f77cd1f71d7ac5a9de6eaefb6 (diff)
downloadnasm-87bc61964cf5d2cc2e322883d6f927a43fb53af3.tar.gz
Diffstat (limited to 'ndisasm.c')
-rw-r--r--ndisasm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ndisasm.c b/ndisasm.c
index ffe6c129..90639e90 100644
--- a/ndisasm.c
+++ b/ndisasm.c
@@ -42,6 +42,7 @@ int main(int argc, char **argv) {
int lenread, lendis;
int autosync = FALSE;
int bits = 16;
+ int eof = FALSE;
int rn_error;
long offset;
FILE *fp;
@@ -191,6 +192,8 @@ int main(int argc, char **argv) {
if (to_read > nextsync-offset-(p-q))
to_read = nextsync-offset-(p-q);
lenread = fread (p, 1, to_read, fp);
+ if (lenread == 0)
+ eof = TRUE; /* help along systems with bad feof */
p += lenread;
if (offset == nextsync) {
if (synclen) {
@@ -218,7 +221,7 @@ int main(int argc, char **argv) {
p -= (q - buffer);
q = buffer;
}
- } while (lenread > 0 || !feof(fp));
+ } while (lenread > 0 || !(eof || feof(fp)));
fclose (fp);
return 0;
}