This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 3/3] Don't use unportable macros
- From: Doug Evans <dje at google dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Tue, 19 Mar 2013 09:31:49 -0700
- Subject: Re: [PATCH 3/3] Don't use unportable macros
- References: <83ip4s4ixc dot fsf at gnu dot org> <1363407692-18959-1-git-send-email-yao at codesourcery dot com> <1363407692-18959-4-git-send-email-yao at codesourcery dot com>
On Fri, Mar 15, 2013 at 9:21 PM, Yao Qi <yao@codesourcery.com> wrote:
> gdb:
>
> 2013-03-16 Yao Qi <yao@codesourcery.com>
>
> * ctf.c (ctf_start): Don't use unportable macros.
> ---
> gdb/ctf.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/ctf.c b/gdb/ctf.c
> index a93dfaf..f66e857 100644
> --- a/gdb/ctf.c
> +++ b/gdb/ctf.c
> @@ -306,8 +306,7 @@ ctf_start (struct trace_file_writer *self, const char *dirname)
> int i;
>
> /* Create DIRNAME. */
> - if (mkdir (dirname, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
> - && errno != EEXIST)
> + if (mkdir (dirname, S_IRUSR | S_IWUSR | S_IXUSR) && errno != EEXIST)
> error (_("Unable to open directory '%s' for saving trace data (%s)"),
> dirname, safe_strerror (errno));
It feels like one would want to use mode 0755 by default on *nix.
Why not store the mode in a local, and have a sequence of #ifdef's
like remote-fileio.c?
[And if you want, tuck the crud away in a helper function to maintain
the S/N ratio of this function.]