From e9bb7b74219eed74e61803994da901aa82cb85fd Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sat, 24 Sep 2022 22:40:25 +0100 Subject: Fix section/extension for links in database In some cases this resulted in spurious database entries. For example, if `man5/inetd.conf.5` was a symlink to `man8/inetd.8` and that page had a `NAME` entry for `inetd`, then as well as entries for `inetd` in section 8 and `inetd.conf` in section 5, we would also store a spurious entry for `inetd` in section 5. We no longer do that. * src/descriptions_store.c (store_descriptions): For names corresponding to entries in the ultimate source trace and not to the base name of the file, use the section and extension of the trace entry rather than of the ultimate source. --- NEWS.md | 2 ++ src/descriptions_store.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/NEWS.md b/NEWS.md index 3fba6468..73c1f2d2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,6 +11,8 @@ Fixes: * Database entries for links were often incorrectly stored as if they were entries for the ultimate source of the page. They are now stored with the correct type. + * Store links in the database using the section and extension of the link + rather than of the ultimate source file. Improvements: diff --git a/src/descriptions_store.c b/src/descriptions_store.c index d0d23441..2425d1b5 100644 --- a/src/descriptions_store.c +++ b/src/descriptions_store.c @@ -133,6 +133,10 @@ void store_descriptions (MYDBM_FILE dbf, gl_list_t descs, struct mandata *info, free_mandata_struct (trace_info); break; } + free (whatis_info->ext); + whatis_info->ext = xstrdup (trace_info->ext); + free (whatis_info->sec); + whatis_info->sec = xstrdup (trace_info->sec); if (!gl_list_next_node (trace, trace_node)) { if (info->id == SO_MAN) whatis_info->id = ULT_MAN; -- cgit v1.2.3