[mlmmj] Re: bug: Index is never incremented

Konstantin Ryabitsev <[email protected]> Sat, 9 Dec 2023 11:59:52 -0500
Newsgroups org.mlmmj.mlmmj
Message-ID <20231209-soft-numbat-of-reading-1bd853@meerkat>
On Sat, Dec 09, 2023 at 11:26:39AM -0500, Konstantin Ryabitsev wrote:
> Hello:
> 
> I just realized that I have a problem with the lists that are set up to use
> 1.4.0 -- the index is never incremented.

Looks like in src/incindexfile.c where we're trying to write to a file that is
open as readonly. The following patch fixes the immediate problem, but you
probably want a test to go with it.

diff --git a/src/incindexfile.c b/src/incindexfile.c
index ce85fa2..33fc50e 100644
--- a/src/incindexfile.c
+++ b/src/incindexfile.c
@@ -51,7 +51,7 @@ int incindexfile(int listfd)
 		return 0;
 	}
 
-	fp = fdopen(fd, "r");
+	fp = fdopen(fd, "r+");
 	if (fp == NULL) {
 		log_error(LOG_ARGS, "Error fdopening index file");
 		close(fd);


-K