1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00
This commit is contained in:
Werner Koch 2010-08-26 08:47:42 +00:00
parent 789732e05a
commit a400cfe14e
9 changed files with 182 additions and 84 deletions

View file

@ -678,18 +678,16 @@ open_control_file (FILE **r_fp, int append)
fp = fopen (fname, append? "a+":"r");
if (!fp && errno == ENOENT)
{
/* Fixme: "x" is a GNU extension. We might want to use the es_
functions here. */
fp = fopen (fname, "wx");
if (!fp)
estream_t stream = es_fopen (fname, "wx,mode=-rw-r");
if (!stream)
{
err = gpg_error (gpg_err_code_from_errno (errno));
err = gpg_error_from_syserror ();
log_error (_("can't create `%s': %s\n"), fname, gpg_strerror (err));
xfree (fname);
return err;
}
fputs (sshcontrolblurb, fp);
fclose (fp);
es_fputs (sshcontrolblurb, stream);
es_fclose (stream);
fp = fopen (fname, append? "a+":"r");
}