From fbcb0e0659618793815a57c5f60ad391ad6f452e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sun, 8 May 2016 16:47:53 +0700 Subject: run-command.c: use error_errno() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- run-command.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'run-command.c') diff --git a/run-command.c b/run-command.c index c72601056..d645a8d8b 100644 --- a/run-command.c +++ b/run-command.c @@ -233,7 +233,7 @@ static int wait_or_whine(pid_t pid, const char *argv0, int in_signal) if (waiting < 0) { failed_errno = errno; - error("waitpid for %s failed: %s", argv0, strerror(errno)); + error_errno("waitpid for %s failed", argv0); } else if (waiting != pid) { error("waitpid is confused (%s)", argv0); } else if (WIFSIGNALED(status)) { @@ -420,8 +420,7 @@ fail_pipe: } } if (cmd->pid < 0) - error("cannot fork() for %s: %s", cmd->argv[0], - strerror(errno)); + error_errno("cannot fork() for %s", cmd->argv[0]); else if (cmd->clean_on_exit) mark_child_for_cleanup(cmd->pid); @@ -482,7 +481,7 @@ fail_pipe: cmd->dir, fhin, fhout, fherr); failed_errno = errno; if (cmd->pid < 0 && (!cmd->silent_exec_failure || errno != ENOENT)) - error("cannot spawn %s: %s", cmd->argv[0], strerror(errno)); + error_errno("cannot spawn %s", cmd->argv[0]); if (cmd->clean_on_exit && cmd->pid >= 0) mark_child_for_cleanup(cmd->pid); @@ -693,7 +692,7 @@ int start_async(struct async *async) if (pipe(fdin) < 0) { if (async->out > 0) close(async->out); - return error("cannot create pipe: %s", strerror(errno)); + return error_errno("cannot create pipe"); } async->in = fdin[1]; } @@ -705,7 +704,7 @@ int start_async(struct async *async) close_pair(fdin); else if (async->in) close(async->in); - return error("cannot create pipe: %s", strerror(errno)); + return error_errno("cannot create pipe"); } async->out = fdout[0]; } @@ -730,7 +729,7 @@ int start_async(struct async *async) async->pid = fork(); if (async->pid < 0) { - error("fork (async) failed: %s", strerror(errno)); + error_errno("fork (async) failed"); goto error; } if (!async->pid) { @@ -777,7 +776,7 @@ int start_async(struct async *async) { int err = pthread_create(&async->tid, NULL, run_thread, async); if (err) { - error("cannot create thread: %s", strerror(err)); + error_errno("cannot create thread"); goto error; } } -- cgit v1.2.1