X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Fwrite_entry.c;h=f480e1996a79d07d5cac245c594ffbc4760d01db;hp=e0a72670e8c6c225d9bf21afb6e76cefe1c4ae22;hb=8d3ea9021573747ecd129228ba7782a03243f62c;hpb=06078d3fa68db669ed37178c01873546b4b28745 diff --git a/ncurses/tinfo/write_entry.c b/ncurses/tinfo/write_entry.c index e0a72670..f480e199 100644 --- a/ncurses/tinfo/write_entry.c +++ b/ncurses/tinfo/write_entry.c @@ -47,7 +47,7 @@ #define TRACE_OUT(p) /*nothing */ #endif -MODULE_ID("$Id: write_entry.c,v 1.99 2017/04/09 23:35:01 tom Exp $") +MODULE_ID("$Id: write_entry.c,v 1.100 2017/11/25 02:06:43 tom Exp $") static int total_written; static int total_parts; @@ -269,6 +269,9 @@ _nc_write_entry(TERMTYPE2 *const tp) #endif #endif /* USE_SYMLINKS */ + unsigned limit2 = sizeof(filename) - (2 + LEAF_LEN); + char saved = '\0'; + static int call_count; static time_t start_time; /* time at start of writes */ @@ -371,12 +374,18 @@ _nc_write_entry(TERMTYPE2 *const tp) start_time = 0; } - if (strlen(first_name) >= sizeof(filename) - (2 + LEAF_LEN)) + if (strlen(first_name) >= sizeof(filename) - (2 + LEAF_LEN)) { _nc_warning("terminal name too long."); + saved = first_name[limit2]; + first_name[limit2] = '\0'; + } _nc_SPRINTF(filename, _nc_SLIMIT(sizeof(filename)) LEAF_FMT "/%s", first_name[0], first_name); + if (saved) + first_name[limit2] = saved; + /* * Has this primary name been written since the first call to * write_entry()? If so, the newer write will step on the older,