Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: RFA: close-on-exec internal file descriptors
Date: Sat, 06 Dec 2008 16:54:00 -0000	[thread overview]
Message-ID: <E1L90Op-0002JC-Ou@fencepost.gnu.org> (raw)
In-Reply-To: <m3bpvpwb1w.fsf@fleche.redhat.com> (message from Tom Tromey on 	Sat, 06 Dec 2008 08:58:03 -0700)

> Cc: gdb-patches@sourceware.org
> From: Tom Tromey <tromey@redhat.com>
> Reply-To: Tom Tromey <tromey@redhat.com>
> Date: Sat, 06 Dec 2008 08:58:03 -0700
> 
> Eli> Relying on glibc is OK for GNU/Linux, but you seem to be modifying
> Eli> files that have no relation to the Linux native builds.  Does that
> Eli> mean the non-glibc builds that don't have the support you are relying
> Eli> on will still leak descriptors?
> 
> No.  In each case, if O_CLOEXEC is not available, we fall back to the
> fcntl-based method.  That is what the calls to "close_on_exec" do in
> the patch.

It seemed to me that the patch assumes too much about the various
#define's -- which is OK if you are targeting glibc, but may need
refinement for other libc's.  But perhaps I missed something; I will
take another look.

> >> +  char new_mode[20];
> >> +  strcpy (new_mode, mode);
> >> +  strcat (new_mode, "e");
> >> +  return fopen (path, new_mode);
> 
> Eli> Can we do something more safe than this arbitrary [20] limitation?
> 
> I don't think there is any point, because the mode argument to fopen
> is never longer than 4 characters or so.  However, if you really want
> this, I will change it to a malloc.

I just don't like relying on "is never longer than N" assumptions, and
GNU coding standards frown on arbitrarily dimensioned arrays, so...


  parent reply	other threads:[~2008-12-06 16:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-06  0:39 Tom Tromey
2008-12-06  8:14 ` Eli Zaretskii
2008-12-06 15:58   ` Tom Tromey
2008-12-06 16:52     ` Daniel Jacobowitz
2008-12-06 17:05       ` Eli Zaretskii
2008-12-06 16:54     ` Eli Zaretskii [this message]
2008-12-06 15:26 ` Daniel Jacobowitz
2008-12-06 15:59   ` Tom Tromey
2008-12-06 15:42 ` Mark Kettenis
2008-12-06 22:06   ` Tom Tromey
2008-12-07 19:26     ` Mark Kettenis

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=E1L90Op-0002JC-Ou@fencepost.gnu.org \
    --to=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.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