run-command.c: use error_errno()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
May 8, 2016 at 16:47 UTC
fbcb0e0659618793815a57c5f60ad391ad6f452e
1 file changed
+7
-8
run-command.c
+7
-8
@@ -233,7 +233,7 @@ static int wait_or_whine(pid_t pid, const char *argv0, int in_signal)
233
234
if (waiting < 0) {
235
failed_errno = errno;
236
- error("waitpid for %s failed: %s", argv0, strerror(errno));
236
+ error_errno("waitpid for %s failed", argv0);
237
} else if (waiting != pid) {
238
error("waitpid is confused (%s)", argv0);
239
} else if (WIFSIGNALED(status)) {
@@ -420,8 +420,7 @@ fail_pipe:
420
}
421
}
422
if (cmd->pid < 0)
423
- error("cannot fork() for %s: %s", cmd->argv[0],
424
- strerror(errno));
423
+ error_errno("cannot fork() for %s", cmd->argv[0]);
424
else if (cmd->clean_on_exit)
425
mark_child_for_cleanup(cmd->pid);
426
@@ -482,7 +481,7 @@ fail_pipe:
481
cmd->dir, fhin, fhout, fherr);
482
failed_errno = errno;
483
if (cmd->pid < 0 && (!cmd->silent_exec_failure || errno != ENOENT))
485
- error("cannot spawn %s: %s", cmd->argv[0], strerror(errno));
484
+ error_errno("cannot spawn %s", cmd->argv[0]);
485
if (cmd->clean_on_exit && cmd->pid >= 0)
486
mark_child_for_cleanup(cmd->pid);
487
@@ -693,7 +692,7 @@ int start_async(struct async *async)
692
if (pipe(fdin) < 0) {
693
if (async->out > 0)
694
close(async->out);
696
- return error("cannot create pipe: %s", strerror(errno));
695
+ return error_errno("cannot create pipe");
696
}
697
async->in = fdin[1];
698
}
@@ -705,7 +704,7 @@ int start_async(struct async *async)
704
close_pair(fdin);
705
else if (async->in)
706
close(async->in);
708
- return error("cannot create pipe: %s", strerror(errno));
707
+ return error_errno("cannot create pipe");
708
}
709
async->out = fdout[0];
710
}
@@ -730,7 +729,7 @@ int start_async(struct async *async)
729
730
async->pid = fork();
731
if (async->pid < 0) {
733
- error("fork (async) failed: %s", strerror(errno));
732
+ error_errno("fork (async) failed");
733
goto error;
734
}
735
if (!async->pid) {
@@ -777,7 +776,7 @@ int start_async(struct async *async)
776
{
777
int err = pthread_create(&async->tid, NULL, run_thread, async);
778
if (err) {
780
- error("cannot create thread: %s", strerror(err));
779
+ error_errno("cannot create thread");
780
goto error;
781
}
782
}