diff options
author | Masatake YAMATO <jet@gyve.org> | 2006-06-03 17:49:36 +0000 |
---|---|---|
committer | Masatake YAMATO <jet@gyve.org> | 2006-06-03 17:49:36 +0000 |
commit | 0f29c66d2557458cd49b32ad48d5baed25533295 (patch) | |
tree | 6cb8847f76e828d15ea59cb619a2a865129ed0c6 /lib-src/ebrowse.c | |
parent | 9781fb53c897dc37a13a490e988977758029a3c2 (diff) | |
download | emacs-0f29c66d2557458cd49b32ad48d5baed25533295.tar.gz |
(main): Exit with EXIT_FAILURE if BROWSE file doesn't exist, is not seekable, not is failed in ftall.
Diffstat (limited to 'lib-src/ebrowse.c')
-rw-r--r-- | lib-src/ebrowse.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index 94fa9114d23..398dd10896e 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c @@ -3909,17 +3909,31 @@ main (argc, argv) fp = fopen (out_filename, "r"); if (fp == NULL) - yyerror ("file `%s' must exist for --append", out_filename); + { + yyerror ("file `%s' must exist for --append", out_filename); + exit (EXIT_FAILURE); + } rc = fseek (fp, 0, SEEK_END); if (rc == -1) - yyerror ("error seeking in file `%s'", out_filename); + { + yyerror ("error seeking in file `%s'", out_filename); + exit (EXIT_FAILURE); + } rc = ftell (fp); if (rc == -1) - yyerror ("error getting size of file `%s'", out_filename); + { + yyerror ("error getting size of file `%s'", out_filename); + exit (EXIT_FAILURE); + } + else if (rc == 0) - yyerror ("file `%s' is empty", out_filename); + { + yyerror ("file `%s' is empty", out_filename); + /* It may be ok to use an empty file for appending. + exit (EXIT_FAILURE); */ + } fclose (fp); } |