From: Junio C Hamano <gitster@pobox.com>
To: David Soria Parra <dsoria@gmx.net>
Cc: git@vger.kernel.org, David Soria Parra <dsp@php.net>
Subject: Re: [PATCH 1/2] Improvate portability: Display pid_t's always as long
Date: Sun, 31 Aug 2008 00:15:10 -0700 [thread overview]
Message-ID: <7vtzd1bqpt.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <48B9B03F.1080304@gmx.net> (David Soria Parra's message of "Sat, 30 Aug 2008 22:40:31 +0200")
David Soria Parra <dsoria@gmx.net> writes:
>> On the other hand, if you are shooting for maximum compatibility perhaps
>> you may want to cast it to "intmax_t" and format as such.
> Yes, good point, casting to long isn't enough. I think it's a good approach to cast the pids to intmax_t as pids
> are also used in git_path() and therefore might result in equal paths for separate processes if
> the pid is higher than int.
>
> so here is an updated patch:
Please wrap lines to reasonable length (e.g. 70-76 cols).
Please move commentary like this that clarifies context of the patch
submission to after three-dashes (emulate patches from people with good
manners).
> From da5519b3ae5ce84c703aeaab2bc4ea363897c334 Mon Sep 17 00:00:00 2001
Especially, don't paste this line.
> From: David Soria Parra <dsp at>
> Date: Fri, 29 Aug 2008 01:19:43 +0200
> Subject: [PATCH] Improvate portability: Cast pid_t's to intmax_t
"Improvate"?
Including these in your message is not very useful. These in-body headers
are used to override what can be read from the real headers of the e-mail
message, but you do not have a valid e-mail address here!
> Some systems (like e.g. OpenSolaris) define pid_t as long,
> ...
> diff --git a/builtin-commit.c b/builtin-commit.c
> index c870037..90ef3d5 100644
> --- a/builtin-commit.c
> +++ b/builtin-commit.c
> @@ -320,7 +320,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
> die("unable to write new_index file");
>
> fd = hold_lock_file_for_update(&false_lock,
> - git_path("next-index-%d", getpid()), 1);
> + git_path("next-index-%jd", (intmax_t) getpid()), 1);
Some systems we support do not have %j width specifier. I'd suggest
casting up to uintmax_t and format with PRIuMAX, which we do define
a substitute for portability.
prev parent reply other threads:[~2008-08-31 7:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-27 17:39 [PATCH 0/2] Improve portability for OpenSolaris David Soria Parra
2008-08-27 17:39 ` [PATCH 1/2] Improvate portability: Display pid_t's always as long David Soria Parra
2008-08-27 17:39 ` [PATCH 2/2] Improve portability: Avoid SS constant as it is already defined David Soria Parra
2008-08-27 18:56 ` Junio C Hamano
2008-08-27 19:17 ` Junio C Hamano
2008-08-28 0:34 ` David Soria Parra
2008-08-27 19:03 ` [PATCH 1/2] Improvate portability: Display pid_t's always as long Junio C Hamano
2008-08-30 20:40 ` David Soria Parra
2008-08-31 7:15 ` Junio C Hamano [this message]
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=7vtzd1bqpt.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=dsoria@gmx.net \
--cc=dsp@php.net \
--cc=git@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).