Skip to content

Commit 90ff12a

Browse files
michaelwookeygitster
authored andcommitted
run-command.c: fix build warnings on Ubuntu
Building git on Ubuntu 9.10 warns that the return value of write(2) isn't checked. These warnings were introduced in commits: 2b541bf ("start_command: detect execvp failures early") a5487dd ("start_command: report child process setup errors to the parent's stderr") GCC details: $ gcc --version gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1 Silence the warnings by reading (but not making use of) the return value of write(2). Signed-off-by: Michael Wookey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e923eae commit 90ff12a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

run-command.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,21 @@ static int child_notifier = -1;
6767

6868
static void notify_parent(void)
6969
{
70-
write(child_notifier, "", 1);
70+
ssize_t unused;
71+
unused = write(child_notifier, "", 1);
7172
}
7273

7374
static NORETURN void die_child(const char *err, va_list params)
7475
{
7576
char msg[4096];
77+
ssize_t unused;
7678
int len = vsnprintf(msg, sizeof(msg), err, params);
7779
if (len > sizeof(msg))
7880
len = sizeof(msg);
7981

80-
write(child_err, "fatal: ", 7);
81-
write(child_err, msg, len);
82-
write(child_err, "\n", 1);
82+
unused = write(child_err, "fatal: ", 7);
83+
unused = write(child_err, msg, len);
84+
unused = write(child_err, "\n", 1);
8385
exit(128);
8486
}
8587

0 commit comments

Comments
 (0)