1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-03-28 22:49:59 +01:00

ssh: Make the mode extension "x" portable by a call to es_fopen.

* agent/command-ssh.c (open_control_file): Use_es_fopen to support
the "wx" mode flag.

--

This also patch also specifies a file mode parameter.  However, this
will only be used with an updated version of es_stream which we have
not yet done.
This commit is contained in:
Werner Koch 2013-07-01 18:08:56 +02:00
parent 8ddf604659
commit 7ce72c97bf

View File

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