X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Fread_entry.c;h=5afbca3573cccfdcdef3c03f771f61426862812b;hp=e5c26b5fa6f2415c7fbebaed3c992027aafae1bd;hb=bdb754b9f04f332b59d72f761a297497b2db8af1;hpb=6be6b9d9202ba34ee545955dc66e355d9855353a diff --git a/ncurses/tinfo/read_entry.c b/ncurses/tinfo/read_entry.c index e5c26b5f..5afbca35 100644 --- a/ncurses/tinfo/read_entry.c +++ b/ncurses/tinfo/read_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * + * Copyright (c) 1998-2015,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -41,7 +41,7 @@ #include -MODULE_ID("$Id: read_entry.c,v 1.128 2014/06/14 22:30:41 tom Exp $") +MODULE_ID("$Id: read_entry.c,v 1.130 2016/05/28 23:22:52 tom Exp $") #define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts)) @@ -432,14 +432,15 @@ _nc_read_file_entry(const char *const filename, TERMTYPE *ptr) { FILE *fp = 0; int code; - int limit; - char buffer[MAX_ENTRY_SIZE + 1]; if (_nc_access(filename, R_OK) < 0 || (fp = fopen(filename, "rb")) == 0) { TR(TRACE_DATABASE, ("cannot open terminfo %s (errno=%d)", filename, errno)); code = TGETENT_NO; } else { + int limit; + char buffer[MAX_ENTRY_SIZE + 1]; + if ((limit = (int) fread(buffer, sizeof(char), sizeof(buffer), fp)) > 0) { @@ -626,6 +627,7 @@ _nc_read_entry(const char *const name, char *const filename, TERMTYPE *const tp) const char *path; _nc_first_db(&state, &offset); + code = TGETENT_ERR; while ((path = _nc_next_db(&state, &offset)) != 0) { TR(TRACE_DATABASE, ("_nc_read_tic_entry path=%s, name=%s", path, name)); code = _nc_read_tic_entry(filename, PATH_MAX, path, name, tp);