This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 3/3] Don't use unportable macros


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.]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]