public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: Tom Tromey <tom@tromey.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH v2 3/6] Move mkdir_recursive to common/filestuff.c
Date: Tue, 30 Oct 2018 21:04:00 -0000	[thread overview]
Message-ID: <f062185a-be33-7966-eced-5e547c373966@ericsson.com> (raw)
In-Reply-To: <87efc7nohb.fsf@tromey.com>

On 2018-10-30 4:55 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:
> 
> Simon> What do you think about this?
> 
> Thanks for doing this.
> 
> Simon>  /* See common/pathstuff.h.  */
> 
> Simon> +std::string
> Simon> +get_standard_temp_dir ()
> Simon> +{
> Simon> +#ifdef WIN32
> Simon> +  char *tmp = getenv ("TMP");
> Simon> +  if (tmp != nullptr)
> Simon> +    return tmp;
> Simon> +
> Simon> +  tmp = getenv ("TEMP");
> Simon> +  if (tmp != nullptr)
> Simon> +    return tmp;
> Simon> +
> Simon> +  error (_("Couldn't find temp dir path, both TMP and TEMP are unset."));
> Simon> +
> Simon> +#else
> Simon> +  return "/tmp";
> 
> It would be normal to look at TMPDIR on unix systems.

Ah, indeed.  How is it with this little fixup on top of the patch?


From e8b9d0eabfb9bd85afcf42af9bdfb6a5bde66fc2 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@ericsson.com>
Date: Tue, 30 Oct 2018 17:01:50 -0400
Subject: [PATCH] fixup

---
 gdb/common/pathstuff.c | 4 ++++
 gdb/common/pathstuff.h | 5 +++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/common/pathstuff.c b/gdb/common/pathstuff.c
index c0c575f3fb4..166a21593eb 100644
--- a/gdb/common/pathstuff.c
+++ b/gdb/common/pathstuff.c
@@ -208,6 +208,10 @@ get_standard_temp_dir ()
   error (_("Couldn't find temp dir path, both TMP and TEMP are unset."));

 #else
+  char *tmp = getenv ("TMPDIR");
+  if (tmp != nullptr)
+    return tmp;
+
   return "/tmp";
 #endif
 }
diff --git a/gdb/common/pathstuff.h b/gdb/common/pathstuff.h
index 18af733ab98..f29349e8b28 100644
--- a/gdb/common/pathstuff.h
+++ b/gdb/common/pathstuff.h
@@ -68,8 +68,9 @@ extern std::string get_standard_cache_dir ();

 /* Get the usual temporary directory for the current platform.

-   On Windows, this is the TMP or TEMP environment variable.  On the rest,
-   it's /tmp.
+   On Windows, this is the TMP or TEMP environment variable.
+
+   On the rest, this is the TMPDIR environment variable, if defined, else /tmp.

    Throw an exception on error.  */

-- 
2.19.1




  reply	other threads:[~2018-10-30 21:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18 22:31 [PATCH v2 0/6] A different approach to startup-with-shell on macOS Tom Tromey
2018-10-18 22:31 ` [PATCH v2 2/6] Move make_temp_filename to common/pathstuff.c Tom Tromey
2018-10-18 22:31 ` [PATCH v2 5/6] Do not reopen temporary files Tom Tromey
2018-10-18 22:31 ` [PATCH v2 4/6] Use mkostemp, not mkstemp Tom Tromey
2018-10-18 22:31 ` [PATCH v2 6/6] Cache a copy of the user's shell on macOS Tom Tromey
2018-10-20  2:35   ` Simon Marchi
2018-10-27 17:43     ` Tom Tromey
2018-10-18 22:31 ` [PATCH v2 1/6] Unify shell-finding logic Tom Tromey
2018-10-19 23:27   ` Sergio Durigan Junior
2018-10-27 17:41     ` Tom Tromey
2018-10-18 22:31 ` [PATCH v2 3/6] Move mkdir_recursive to common/filestuff.c Tom Tromey
2018-10-29 16:01   ` Simon Marchi
2018-10-29 22:16     ` Simon Marchi
2018-10-30 20:55       ` Tom Tromey
2018-10-30 21:04         ` Simon Marchi [this message]
2018-10-31 15:03           ` Tom Tromey
2018-11-01 19:44             ` Simon Marchi
2018-10-19 23:41 ` [PATCH v2 0/6] A different approach to startup-with-shell on macOS Sergio Durigan Junior
2018-10-27 17:58   ` Tom Tromey
  -- strict thread matches above, loose matches on Subject: below --
2018-10-03 21:02 [PATCH 2 0/6] A different approach to starutp-with-shell " Tom Tromey
2018-10-03 21:02 ` [PATCH v2 3/6] Move mkdir_recursive to common/filestuff.c Tom Tromey

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=f062185a-be33-7966-eced-5e547c373966@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).