Pádraig Brady <[email protected]> writes:
> On 23/10/2025 20:44, Collin Funk wrote:
>> Collin Funk <[email protected]> writes:
>>
>>> Thanks, I pushed it with those changes [1].
>> Oops, tiny oversight. Forgot to call posix_spawnattr_destroy and
>> posix_spawn_file_actions_destroy when we successfully call posix_spawn.
>> I pushed the attached patch to fix that.
>
> Does that mean we don't need the ignore_value() wrapping in install.c?
Yep, I am not really sure why I used it since glibc doesn't give it the
warn_unused_result attribute.
Pushed the attached patch to remove that. Also regarding these lines:
if (attrp)
- ignore_value (posix_spawnattr_destroy (&attr));
+ posix_spawnattr_destroy (attrp);
It felt a bit awkward to check the pointer and then not use it as the
argument. No functional change, but makes things easier to read IMO.
Collin
>From a2a2f22efe12c3394e1f19e0104c67988b2044c8 Mon Sep 17 00:00:00 2001
Message-ID: <a2a2f22efe12c3394e1f19e0104c67988b2044c8.1761255913.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Thu, 23 Oct 2025 14:40:39 -0700
Subject: [PATCH] maint: remove unnecessary ignore_value usage
* src/install.c: Remove ignore-value.h include.
(strip): Don't use ignore_value on posix_spawnattr_destroy since it
isn't declared with the warn_unused_result attribute. Pass the checked
pointer to posix_spawnattr_destroy instead of the variable it points to.
---
src/install.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/install.c b/src/install.c
index 26bc16e11..b01253997 100644
--- a/src/install.c
+++ b/src/install.c
@@ -33,7 +33,6 @@
#include "copy.h"
#include "filenamecat.h"
#include "full-read.h"
-#include "ignore-value.h"
#include "mkancesdirs.h"
#include "mkdir-p.h"
#include "modechange.h"
@@ -501,7 +500,7 @@ strip (char const *name)
if (posix_spawnattr_setflags (&attr, POSIX_SPAWN_USEVFORK) == 0)
attrp = &attr;
else
- ignore_value (posix_spawnattr_destroy (&attr));
+ posix_spawnattr_destroy (&attr);
}
/* Construct the arguments to 'strip'. */
@@ -539,7 +538,7 @@ strip (char const *name)
free (concat_name);
if (attrp)
- ignore_value (posix_spawnattr_destroy (&attr));
+ posix_spawnattr_destroy (attrp);
return ok;
}
--
2.51.0