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: 2b541bf8 ("start_command: detect execvp failures early") a5487ddf ("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 <michaelwookey@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Wookey committed
Jan 30, 2010 at 09:38 UTC
90ff12a86073e27c9f423a255a4da4314c28936d
1 file changed
+6
-4
run-command.c
+6
-4
@@ -67,19 +67,21 @@ static int child_notifier = -1;
67
68
static void notify_parent(void)
69
{
70
- write(child_notifier, "", 1);
70
+ ssize_t unused;
71
+ unused = write(child_notifier, "", 1);
72
}
73
74
static NORETURN void die_child(const char *err, va_list params)
75
{
76
char msg[4096];
77
+ ssize_t unused;
78
int len = vsnprintf(msg, sizeof(msg), err, params);
79
if (len > sizeof(msg))
80
len = sizeof(msg);
81
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);
85
exit(128);
86
}
87