bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17187: 24.3.50.1 open-dribble-file stores pw


From: Daniel Colascione
Subject: bug#17187: 24.3.50.1 open-dribble-file stores pw
Date: Sat, 05 Apr 2014 16:14:19 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

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: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]