Index: gas/input-file.c =================================================================== RCS file: /cvs/src/src/gas/input-file.c,v retrieving revision 1.27 diff -u -3 -p -r1.27 input-file.c --- gas/input-file.c 2 Sep 2009 07:24:19 -0000 1.27 +++ gas/input-file.c 27 Oct 2010 14:02:11 -0000 @@ -157,6 +157,15 @@ input_file_open (char *filename, /* "" m return; } + /* Check for an empty input file. */ + if (feof (f_in)) + { + fclose (f_in); + f_in = NULL; + return; + } + gas_assert (c != EOF); + if (c == '#') { /* Begins with comment, may not want to preprocess. */ @@ -209,6 +218,9 @@ input_file_get (char *buf, int buflen) { int size; + if (feof (f_in)) + return 0; + size = fread (buf, sizeof (char), buflen, f_in); if (size < 0) { @@ -235,7 +247,13 @@ input_file_give_next_buffer (char *where if (preprocess) size = do_scrub_chars (input_file_get, where, BUFFER_SIZE); else - size = fread (where, sizeof (char), BUFFER_SIZE, f_in); + { + if (feof (f_in)) + size = 0; + else + size = fread (where, sizeof (char), BUFFER_SIZE, f_in); + } + if (size < 0) { as_bad (_("can't read from %s: %s"), file_name, xstrerror (errno));