diff options
Diffstat (limited to 'Build/source/texk/dviout-util/chkdvifont.c')
-rw-r--r-- | Build/source/texk/dviout-util/chkdvifont.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Build/source/texk/dviout-util/chkdvifont.c b/Build/source/texk/dviout-util/chkdvifont.c index 1453490e546..acf2df8bea9 100644 --- a/Build/source/texk/dviout-util/chkdvifont.c +++ b/Build/source/texk/dviout-util/chkdvifont.c @@ -71,6 +71,7 @@ #include <config.h> #include "dd.h" +#include "common.h" #define ID 2 #define ID_PTEX 3 @@ -430,7 +431,7 @@ int chk_font_file(FILE * fp) finfo = (struct FINFO *)gth_buf; fardir = (struct FARDIR *)gth_buf; - fread(gth_buf, sizeof(struct FINFO), 1, fp); + if (fread(gth_buf, sizeof(struct FINFO), 1, fp)<1) goto err; if (strcmp(gth_buf + 8, "gather") == 0) goto gth; @@ -451,7 +452,7 @@ int chk_font_file(FILE * fp) if (f_v) printf("\n"); fseek(fp, start, SEEK_SET); - fread((char *)fardir, sizeof(struct FARDIR), 1, fp); + if (fread((char *)fardir, sizeof(struct FARDIR), 1, fp)<1) goto err; start = ftell(fp); font.n = fardir->f_name; @@ -475,11 +476,11 @@ int chk_font_file(FILE * fp) if (f_v) printf("\n"); fseek(fp, start, SEEK_SET); - fread(gth_buf, sizeof(struct FINFO), 1, fp); + if (fread(gth_buf, sizeof(struct FINFO), 1, fp)<1) goto err; start = ftell(fp); font.n = finfo->f_name; - printf("%s:%d(%d)\n", + printf("%s:%ld(%ld)\n", font.n, to_long(finfo->f_pos), to_long(finfo->f_size)); f_end = to_long(finfo->f_pos) + to_long(finfo->f_size); fseek(fp, to_long(finfo->f_pos), SEEK_SET); @@ -488,6 +489,10 @@ int chk_font_file(FILE * fp) printf("\n"); } return (0); + + err: + fprintf(stderr, "Cannot read data\n"); + exit(250); } void show_dvi_data(DVIFILE_INFO *dvi) @@ -1284,7 +1289,7 @@ void get_list(char *fname) return; if (buf[0] == '#' || buf[0] == ';') continue; - if (sscanf(buf, "%15s %X %X", + if (sscanf(buf, "%15s %lX %lX", chkfont[n_data].f_name, &(chkfont[n_data].oldd), &(chkfont[n_data].neww)) != 3) { @@ -1358,6 +1363,7 @@ void usage() "eufm10 BF989013 8F256EB2\n" "# The line beginning with # or ; is ignored.\n" ); + fprintf(stderr, "\nEmail bug reports to %s.\n", BUG_ADDRESS); exit(0); } |