Don't overwrite the input file.

* src/files.c (output_file_name_check): Fatal error if using input file
for output.
* tests/output.at: (AT_CHECK_CONFLICTING_OUTPUT): Add return status
argument.
(Conflicting output files): Add test.
This commit is contained in:
Di-an Jan
2008-10-28 21:38:32 -04:00
committed by Joel E. Denny
parent 482dc52fb7
commit c0ee9e2115
3 changed files with 19 additions and 3 deletions

View File

@@ -351,6 +351,8 @@ compute_output_file_names (void)
void
output_file_name_check (char const *file_name)
{
if (0 == strcmp (file_name, grammar_file))
fatal (_("refusing to overwrite the input file %s"), quote (file_name));
{
int i;
for (i = 0; i < file_names_count; i++)