unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Colascione <dancol@dancol.org>
To: Glenn Morris <rgm@gnu.org>, Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: 17187@debbugs.gnu.org
Subject: bug#17187: 24.3.50.1 open-dribble-file stores pw
Date: Sat, 05 Apr 2014 16:14:19 -0700	[thread overview]
Message-ID: <53408E4B.9060605@dancol.org> (raw)
In-Reply-To: <l01txbv0rv.fsf@fencepost.gnu.org>

[-- Attachment #1: Type: text/plain, Size: 934 bytes --]

On 04/05/2014 04:01 PM, Glenn Morris wrote:
> ***************
> *** 10085,10092 ****
>       }
>     if (!NILP (file))
>       {
>         file = Fexpand_file_name (file, Qnil);
> !       dribble = emacs_fopen (SSDATA (file), "w");
>         if (dribble == 0)
>   	report_file_error ("Opening dribble", file);
>       }
> --- 10086,10100 ----
>       }
>     if (!NILP (file))
>       {
> +       int fd;
>         file = Fexpand_file_name (file, Qnil);
> !       if (! NILP (Ffile_exists_p (file)))
> !         {
> !           if (chmod (SSDATA (file), 0600) < 0)
> !             report_file_error ("Doing chmod", file);
> !         }
> !       fd = emacs_open (SSDATA (file), O_WRONLY | O_CREAT | O_TRUNC, 0600);
> !       dribble = fd < 0 ? 0 : fdopen (fd, "w");
>         if (dribble == 0)

That's racy. What about using fchmod and falling back to post-open chmod
for systems that don't have fchmod?


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

  reply	other threads:[~2014-04-05 23:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-04 17:35 bug#17187: 24.3.50.1 open-dribble-file stores pw Andreas Röhler
2014-04-04 21:42 ` Glenn Morris
2014-04-05  7:54   ` Andreas Röhler
2014-04-05  7:58   ` Andreas Röhler
2014-04-05 15:50   ` Stefan Monnier
2014-04-05 16:37     ` Andreas Röhler
2014-04-05 16:55       ` Andreas Schwab
2014-04-05 18:07         ` Andreas Röhler
2014-04-05 19:24           ` Andreas Schwab
2014-04-05 17:22     ` Glenn Morris
2014-04-05 22:02       ` Stefan Monnier
2014-04-05 23:01         ` Glenn Morris
2014-04-05 23:14           ` Daniel Colascione [this message]
2014-04-06  2:05             ` Glenn Morris
2014-04-11  5:49           ` Glenn Morris

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53408E4B.9060605@dancol.org \
    --to=dancol@dancol.org \
    --cc=17187@debbugs.gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    --cc=rgm@gnu.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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