X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Fwrite_entry.c;h=9fdfe59d97113c955b65478a772a9e725f15822f;hp=0c992b66402e7ebe9bca5aa25f64c5524e7e5179;hb=0573f2d712e4b5cb2a02a3fe52d513843d536b34;hpb=8b06e371ed1bce3dd6f37138e6becb5e1a562fe0 diff --git a/ncurses/tinfo/write_entry.c b/ncurses/tinfo/write_entry.c index 0c992b66..9fdfe59d 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.84 2012/02/22 22:40:24 tom Exp $") +MODULE_ID("$Id: write_entry.c,v 1.86 2012/06/16 16:59:05 tom Exp $") static int total_written; @@ -372,7 +372,22 @@ _nc_write_entry(TERMTYPE *const tp) if (start_time > 0 && stat(filename, &statbuf) >= 0 && statbuf.st_mtime >= start_time) { +#if HAVE_LINK && !USE_SYMLINKS + /* + * If the file has more than one link, the reason for the previous + * write could be that the current primary name used to be an alias for + * the previous entry. In that case, unlink the file so that we will + * not modify the previous entry as we write this one. + */ + if (statbuf.st_nlink > 1) { + _nc_warning("name redefined."); + unlink(filename); + } else { + _nc_warning("name multiply defined."); + } +#else _nc_warning("name multiply defined."); +#endif } check_writeable(first_name[0]);