"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Johannes Thyssen Tishman <johannes@thyssentishman.com>
Subject:
Remove /tmp/got-importmsg on empty import commit message
To:
gameoftrees@openbsd.org
Date:
Sat, 26 Apr 2025 18:14:52 +0000

Download raw body.

Thread
While testing the symlink behavior from my previous email I noticed some
leftover /tmp/got-importmsg files that were not cleaned after incomplete
imports with empty commit messages. From what I understand, this happens
because the logmsg_path pointer is freed before unlink() can be called
even when the pointer is already being freed in cmd_import(). Is this
correct? The diff below seems to fix this for me. Regression tests are
all passing.

diff /tmp/got
path + /tmp/got
commit - 43da8b281f78341ca4cb9784e84693fb599e296a
blob - 1566a18d6ca7647bf2749dee035e95cd38cec034
file + got/got.c
--- got/got.c
+++ got/got.c
@@ -609,10 +609,6 @@ done:
 	if (fd != -1 && close(fd) == -1 && err == NULL)
 		err = got_error_from_errno2("close", *logmsg_path);
 	free(initial_content);
-	if (err) {
-		free(*logmsg_path);
-		*logmsg_path = NULL;
-	}
 	return err;
 }