Skip to content

Commit ce41759

Browse files
peffgitster
authored andcommitted
run-command: mark error routine parameters as unused
After forking but before exec-ing a command, we install special error/warn/die handlers in the child. These ignore the error messages they get, since the idea is that they shouldn't be called in the first place. Arguably they could pass along that error message _in addition_ to saying "error() should not be called in a child", but since the whole point is to avoid any conflicts on stdio/malloc locks, etc, we're better to just keep these simple. Seeing them trigger is effectively a bug, and the developer is probably better off grabbing a stack trace. But we do want to mark the functions so that -Wunused-parameter doesn't complain. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d3dcfa0 commit ce41759

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

run-command.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,19 +341,19 @@ static void child_close_pair(int fd[2])
341341
child_close(fd[1]);
342342
}
343343

344-
static void child_error_fn(const char *err, va_list params)
344+
static void child_error_fn(const char *err UNUSED, va_list params UNUSED)
345345
{
346346
const char msg[] = "error() should not be called in child\n";
347347
xwrite(2, msg, sizeof(msg) - 1);
348348
}
349349

350-
static void child_warn_fn(const char *err, va_list params)
350+
static void child_warn_fn(const char *err UNUSED, va_list params UNUSED)
351351
{
352352
const char msg[] = "warn() should not be called in child\n";
353353
xwrite(2, msg, sizeof(msg) - 1);
354354
}
355355

356-
static void NORETURN child_die_fn(const char *err, va_list params)
356+
static void NORETURN child_die_fn(const char *err UNUSED, va_list params UNUSED)
357357
{
358358
const char msg[] = "die() should not be called in child\n";
359359
xwrite(2, msg, sizeof(msg) - 1);

0 commit comments

Comments
 (0)