1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

Fixed a problem in estream-printf.c.

Changes for Windows (gpgsm -k does now work).
Minor cleanups.
This commit is contained in:
Werner Koch 2007-06-25 11:54:43 +00:00
parent 0b66f30d66
commit 831cd76256
18 changed files with 520 additions and 182 deletions

View file

@ -1,3 +1,13 @@
2007-06-25 Werner Koch <wk@g10code.com>
* gpgsm.c (check_special_filename): Use translate_sys2libc_fd and
add new arg FOR_WRITE. Change callers to pass new arg.
2007-06-24 Werner Koch <wk@g10code.com>
* gpgsm.c (open_es_fwrite): Avoid the dup by using the new
es_fdopen_nc().
2007-06-21 Werner Koch <wk@g10code.com>
* certreqgen-ui.c: New.

View file

@ -573,8 +573,8 @@ proc_parameters (ctrl_t ctrl,
if (rc)
{
r = get_parameter (para, pKEYTYPE, 0);
log_error (_("line %d: key generation failed: %s\n"),
r->lnr, gpg_strerror (rc));
log_error (_("line %d: key generation failed: %s <%s>\n"),
r->lnr, gpg_strerror (rc), gpg_strsource (rc));
xfree (cardkeyid);
return rc;
}
@ -863,8 +863,8 @@ gpgsm_genkey (ctrl_t ctrl, int in_fd, FILE *in_stream, FILE *out_fp)
rc = read_parameters (ctrl, in_fp, writer);
if (rc)
{
log_error ("error creating certificate request: %s\n",
gpg_strerror (rc));
log_error ("error creating certificate request: %s <%s>\n",
gpg_strerror (rc), gpg_strsource (rc));
goto leave;
}

View file

@ -481,7 +481,7 @@ static void set_cmd (enum cmd_and_opt_values *ret_cmd,
enum cmd_and_opt_values new_cmd );
static void emergency_cleanup (void);
static int check_special_filename (const char *fname);
static int check_special_filename (const char *fname, int for_write);
static int open_read (const char *filename);
static FILE *open_fwrite (const char *filename);
static estream_t open_es_fwrite (const char *filename);
@ -1732,7 +1732,7 @@ gpgsm_init_default_ctrl (struct server_control_s *ctrl)
/* Check whether the filename has the form "-&nnnn", where n is a
non-zero number. Returns this number or -1 if it is not the case. */
static int
check_special_filename (const char *fname)
check_special_filename (const char *fname, int for_write)
{
if (allow_special_filenames
&& fname && *fname == '-' && fname[1] == '&' ) {
@ -1742,7 +1742,7 @@ check_special_filename (const char *fname)
for (i=0; isdigit (fname[i]); i++ )
;
if ( !fname[i] )
return atoi (fname);
return translate_sys2libc_fd (atoi (fname), for_write);
}
return -1;
}
@ -1762,7 +1762,7 @@ open_read (const char *filename)
set_binary (stdin);
return 0; /* stdin */
}
fd = check_special_filename (filename);
fd = check_special_filename (filename, 0);
if (fd != -1)
return fd;
fd = open (filename, O_RDONLY | O_BINARY);
@ -1790,7 +1790,7 @@ open_fwrite (const char *filename)
return stdout;
}
fd = check_special_filename (filename);
fd = check_special_filename (filename, 1);
if (fd != -1)
{
fp = fdopen (dup (fd), "wb");
@ -1825,14 +1825,14 @@ open_es_fwrite (const char *filename)
if (filename[0] == '-' && !filename[1])
{
fflush (stdout);
fp = es_fdopen (dup (fileno(stdout)), "wb");
fp = es_fdopen_nc (fileno(stdout), "wb");
return fp;
}
fd = check_special_filename (filename);
fd = check_special_filename (filename, 1);
if (fd != -1)
{
fp = es_fdopen (dup (fd), "wb");
fp = es_fdopen_nc (fd, "wb");
if (!fp)
{
log_error ("es_fdopen(%d) failed: %s\n", fd, strerror (errno));