From: David Aguilar <davvid@gmail.com>
To: gitster@pobox.com
Cc: johannes.schindelin@gmx.de, git@vger.kernel.org,
markus.heidelberg@web.de, nick@incise.org
Subject: Re: [PATCH] diff: generate prettier filenames when using GIT_EXTERNAL_DIFF
Date: Mon, 25 May 2009 03:36:06 -0700 [thread overview]
Message-ID: <20090525103604.GB13411@gmail.com> (raw)
In-Reply-To: <1243226693-72293-1-git-send-email-davvid@gmail.com>
On Sun, May 24, 2009 at 09:44:53PM -0700, David Aguilar wrote:
> diff --git a/path.c b/path.c
> index 8a0a674..c2a0fb6 100644
> --- a/path.c
> +++ b/path.c
> @@ -140,6 +140,24 @@ int git_mkstemp(char *path, size_t len, const char *template)
> }
>
>
> +/* git_mkstemp() - create tmp file with suffix honoring TMPDIR variable */
> +int git_mkstemps(char *path, size_t len, const char *template, int suffix_len)
> +{
> + const char *tmp;
> + size_t n;
> +
> + tmp = getenv("TMPDIR");
> + if (!tmp)
> + tmp = "/tmp";
> + n = snprintf(path, len, "%s/%s", tmp, template);
> + if (len <= n) {
> + errno = ENAMETOOLONG;
> + return -1;
> + }
> + return mkstemps(path, suffix_len);
> +}
Lured by a mac. I came home and I tried it on linux:
path.c:157: warning: implicit declaration of function
‘mkstemps’
Gah.
Darn you OS X and your non-portable 4.4 BSD extensions.
Sorry about that.
The original patch could do without the strbuf_detach
and free(), too. Being tricked by an OS X manpage like
that is quite unpleasant.
mkstemp() won't do since it doesn't work with suffixes
(the templates must end with "XXXX"). I'm sure there has to
be another way, but I just can't think of it right now.
It seemed so easy at the time.
Sigh...
--
David
parent reply other threads:[~2009-05-25 10:36 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <1243226693-72293-1-git-send-email-davvid@gmail.com>]
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=20090525103604.GB13411@gmail.com \
--to=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmx.de \
--cc=markus.heidelberg@web.de \
--cc=nick@incise.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).