tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

nbctfmerge handling of outfile



Native ctfmerge on netbsd doesn't delete its output on failure.  Cf.
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c - the ifdef in
terminate_cleanup.

However that ifdef doesn't kick in for tools build on non-netbsd
hosts, that makes nbctfmerge behave differently from the native one.

Any objections to the following patch?  Do I miss anything?

--- ctfmerge.c.~1.18.~	2023-07-16 04:03:58.022071999 +0300
+++ ctfmerge.c	2023-12-26 21:37:04.371052514 +0300
@@ -682,7 +682,7 @@ terminate_cleanup(void)
 	if (outfile == NULL)
 		return;
 
-#if !defined (__FreeBSD__) && !defined(__NetBSD__)
+#if !defined (__FreeBSD__) && !(defined(__NetBSD__) || HAVE_NBTOOL_CONFIG_H)
 	if (dounlink) {
 		fprintf(stderr, "Removing %s\n", outfile);
 		unlink(outfile);

PS: While here, shouldn't the outfile test just above be inside the
ifdef as well?  It's dead code otherwise and gcc optimizes it away
anyway.

-uwe


Home | Main Index | Thread Index | Old Index