From: Johannes Sixt <j.sixt@viscovery.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 4/7] run_command: report system call errors instead of returning error codes
Date: Mon, 06 Jul 2009 09:37:35 +0200 [thread overview]
Message-ID: <4A51A9BF.5050104@viscovery.net> (raw)
In-Reply-To: <ea2d8110ea70b8698bb3674ca4482db64053d841.1246734159.git.j6t@kdbg.org>
Johannes Sixt schrieb:
> cmd->pid = mingw_spawnvpe(cmd->argv[0], cmd->argv, env);
> + if (cmd->pid < 0 && errno != ENOENT)
> + error("cannot spawn %s: %s", cmd->argv[0],
> + strerror(failed_errno = errno));
>
> if (cmd->env)
> free_environ(env);
> @@ -189,7 +203,6 @@ int start_command(struct child_process *cmd)
> #endif
>
> if (cmd->pid < 0) {
> - int err = errno;
> if (need_in)
> close_pair(fdin);
> else if (cmd->in)
> @@ -200,9 +213,8 @@ int start_command(struct child_process *cmd)
> close(cmd->out);
> if (need_err)
> close_pair(fderr);
> - return err == ENOENT ?
> - -ERR_RUN_COMMAND_EXEC :
> - -ERR_RUN_COMMAND_FORK;
> + errno = failed_errno;
> + return -1;
> }
Sorry to bother you once again. 'gcc -O2' correctly points out that
failed_errno could be used uninitialized (MinGW code path only).
Would you please squash this in?
-- Hannes
diff --git a/run-command.c b/run-command.c
--- a/run-command.c
+++ b/run-command.c
@@ -184,9 +184,9 @@ fail_pipe:
}
cmd->pid = mingw_spawnvpe(cmd->argv[0], cmd->argv, env);
+ failed_errno = errno;
if (cmd->pid < 0 && (!cmd->silent_exec_failure || errno != ENOENT))
- error("cannot spawn %s: %s", cmd->argv[0],
- strerror(failed_errno = errno));
+ error("cannot spawn %s: %s", cmd->argv[0], strerror(errno));
if (cmd->env)
free_environ(env);
next prev parent reply other threads:[~2009-07-06 7:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-04 19:26 [PATCH 0/7] rework run_command error reporting Johannes Sixt
2009-07-04 19:26 ` [PATCH 1/7] Truncate result of run_command that is used in exit() to lowest 8 bits Johannes Sixt
2009-07-05 18:57 ` [Replacement PATCH 1/7] MinGW: truncate exit()'s argument " Johannes Sixt
2009-07-04 19:26 ` [PATCH 2/7] MinGW: simplify waitpid() emulation macros Johannes Sixt
2009-07-04 19:26 ` [PATCH 3/7] run_command: return exit code as positive value Johannes Sixt
2009-07-04 19:26 ` [PATCH 4/7] run_command: report system call errors instead of returning error codes Johannes Sixt
2009-07-05 19:01 ` Johannes Sixt
2009-07-05 19:14 ` Junio C Hamano
2009-07-06 7:37 ` Johannes Sixt [this message]
2009-07-04 19:26 ` [PATCH 5/7] run_command: encode deadly signal number in the return value Johannes Sixt
2009-07-04 19:26 ` [PATCH 6/7] run_command: report failure to execute the program, but optionally don't Johannes Sixt
2009-07-04 19:26 ` [PATCH/RFC 7/7] receive-pack: remove unnecessary run_status report Johannes Sixt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A51A9BF.5050104@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.