Skip to content

Commit fbcb0e0

Browse files
pcloudsgitster
authored andcommitted
run-command.c: use error_errno()
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 033e011 commit fbcb0e0

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

run-command.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ static int wait_or_whine(pid_t pid, const char *argv0, int in_signal)
233233

234234
if (waiting < 0) {
235235
failed_errno = errno;
236-
error("waitpid for %s failed: %s", argv0, strerror(errno));
236+
error_errno("waitpid for %s failed", argv0);
237237
} else if (waiting != pid) {
238238
error("waitpid is confused (%s)", argv0);
239239
} else if (WIFSIGNALED(status)) {
@@ -420,8 +420,7 @@ int start_command(struct child_process *cmd)
420420
}
421421
}
422422
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]);
425424
else if (cmd->clean_on_exit)
426425
mark_child_for_cleanup(cmd->pid);
427426

@@ -482,7 +481,7 @@ int start_command(struct child_process *cmd)
482481
cmd->dir, fhin, fhout, fherr);
483482
failed_errno = errno;
484483
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]);
486485
if (cmd->clean_on_exit && cmd->pid >= 0)
487486
mark_child_for_cleanup(cmd->pid);
488487

@@ -693,7 +692,7 @@ int start_async(struct async *async)
693692
if (pipe(fdin) < 0) {
694693
if (async->out > 0)
695694
close(async->out);
696-
return error("cannot create pipe: %s", strerror(errno));
695+
return error_errno("cannot create pipe");
697696
}
698697
async->in = fdin[1];
699698
}
@@ -705,7 +704,7 @@ int start_async(struct async *async)
705704
close_pair(fdin);
706705
else if (async->in)
707706
close(async->in);
708-
return error("cannot create pipe: %s", strerror(errno));
707+
return error_errno("cannot create pipe");
709708
}
710709
async->out = fdout[0];
711710
}
@@ -730,7 +729,7 @@ int start_async(struct async *async)
730729

731730
async->pid = fork();
732731
if (async->pid < 0) {
733-
error("fork (async) failed: %s", strerror(errno));
732+
error_errno("fork (async) failed");
734733
goto error;
735734
}
736735
if (!async->pid) {
@@ -777,7 +776,7 @@ int start_async(struct async *async)
777776
{
778777
int err = pthread_create(&async->tid, NULL, run_thread, async);
779778
if (err) {
780-
error("cannot create thread: %s", strerror(err));
779+
error_errno("cannot create thread");
781780
goto error;
782781
}
783782
}

0 commit comments

Comments
 (0)