mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Minor fixes.
This commit is contained in:
parent
78ff45c49e
commit
382d2f8efb
23 changed files with 106 additions and 54 deletions
|
@ -1,3 +1,15 @@
|
|||
2008-12-09 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gpg.c (open_info_file): Add arg BINARY and adjust callers.
|
||||
|
||||
* gpg.c (main): Call i18n_init before init_common_subsystems.
|
||||
* gpgv.c (main): Ditto.
|
||||
|
||||
* keylist.c (set_attrib_fd): Do not close ATTRIB_FP if it is the
|
||||
log stream.
|
||||
(set_attrib_fd) [W32]: Set to binary mode.
|
||||
(dump_attribs): Flush the stream after writing.
|
||||
|
||||
2008-12-05 Werner Koch <wk@g10code.com>
|
||||
|
||||
* call-agent.c (percent_plus_escape): Rename to
|
||||
|
|
|
@ -229,7 +229,7 @@ write_status_buffer ( int no, const char *buffer, size_t len, int wrap )
|
|||
|
||||
|
||||
/* Print the BEGIN_SIGNING status message. If MD is not NULL it is
|
||||
used retrieve the hash algorithms used for the message. */
|
||||
used to retrieve the hash algorithms used for the message. */
|
||||
void
|
||||
write_status_begin_signing (gcry_md_hd_t md)
|
||||
{
|
||||
|
|
28
g10/gpg.c
28
g10/gpg.c
|
@ -1036,9 +1036,9 @@ set_screen_dimensions(void)
|
|||
used with --status-file etc functions. Not generally useful but it
|
||||
avoids the riscos specific functions and well some Windows people
|
||||
might like it too. Prints an error message and returns -1 on
|
||||
error. On success the file descriptor is returned. */
|
||||
error. On success the file descriptor is returned. */
|
||||
static int
|
||||
open_info_file (const char *fname, int for_write)
|
||||
open_info_file (const char *fname, int for_write, int binary)
|
||||
{
|
||||
#ifdef __riscos__
|
||||
return riscos_fdopenfile (fname, for_write);
|
||||
|
@ -1048,10 +1048,16 @@ open_info_file (const char *fname, int for_write)
|
|||
similar to the option file but in that case it is unlikely that
|
||||
sensitive information may be retrieved by means of error
|
||||
messages. */
|
||||
(void)fname;
|
||||
(void)for_write;
|
||||
(void)binary;
|
||||
return -1;
|
||||
#else
|
||||
int fd;
|
||||
|
||||
if (binary)
|
||||
binary = MY_O_BINARY;
|
||||
|
||||
/* if (is_secured_filename (fname)) */
|
||||
/* { */
|
||||
/* fd = -1; */
|
||||
|
@ -1062,10 +1068,10 @@ open_info_file (const char *fname, int for_write)
|
|||
do
|
||||
{
|
||||
if (for_write)
|
||||
fd = open (fname, O_CREAT | O_TRUNC | O_WRONLY,
|
||||
fd = open (fname, O_CREAT | O_TRUNC | O_WRONLY | binary,
|
||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
|
||||
else
|
||||
fd = open (fname, O_RDONLY | MY_O_BINARY);
|
||||
fd = open (fname, O_RDONLY | binary);
|
||||
}
|
||||
while (fd == -1 && errno == EINTR);
|
||||
/* } */
|
||||
|
@ -1910,6 +1916,7 @@ main (int argc, char **argv)
|
|||
log_set_prefix ("gpg", 1);
|
||||
|
||||
/* Make sure that our subsystems are ready. */
|
||||
i18n_init();
|
||||
init_common_subsystems ();
|
||||
|
||||
/* Check that the libraries are suitable. Do it right here because the
|
||||
|
@ -1929,7 +1936,6 @@ main (int argc, char **argv)
|
|||
|
||||
create_dotlock(NULL); /* Register locking cleanup. */
|
||||
|
||||
i18n_init();
|
||||
|
||||
opt.command_fd = -1; /* no command fd */
|
||||
opt.compress_level = -1; /* defaults to standard compress level */
|
||||
|
@ -2216,16 +2222,16 @@ main (int argc, char **argv)
|
|||
case oDebugLevel: debug_level = pargs.r.ret_str; break;
|
||||
|
||||
case oStatusFD:
|
||||
set_status_fd( translate_sys2libc_fd_int (pargs.r.ret_int, 1) );
|
||||
set_status_fd ( translate_sys2libc_fd_int (pargs.r.ret_int, 1) );
|
||||
break;
|
||||
case oStatusFile:
|
||||
set_status_fd ( open_info_file (pargs.r.ret_str, 1) );
|
||||
set_status_fd ( open_info_file (pargs.r.ret_str, 1, 0) );
|
||||
break;
|
||||
case oAttributeFD:
|
||||
set_attrib_fd(translate_sys2libc_fd_int (pargs.r.ret_int, 1));
|
||||
set_attrib_fd ( translate_sys2libc_fd_int (pargs.r.ret_int, 1) );
|
||||
break;
|
||||
case oAttributeFile:
|
||||
set_attrib_fd ( open_info_file (pargs.r.ret_str, 1) );
|
||||
set_attrib_fd ( open_info_file (pargs.r.ret_str, 1, 1) );
|
||||
break;
|
||||
case oLoggerFD:
|
||||
log_set_fd (translate_sys2libc_fd_int (pargs.r.ret_int, 1));
|
||||
|
@ -2522,14 +2528,14 @@ main (int argc, char **argv)
|
|||
pwfd = translate_sys2libc_fd_int (pargs.r.ret_int, 0);
|
||||
break;
|
||||
case oPasswdFile:
|
||||
pwfd = open_info_file (pargs.r.ret_str, 0);
|
||||
pwfd = open_info_file (pargs.r.ret_str, 0, 1);
|
||||
break;
|
||||
case oPasswdRepeat: opt.passwd_repeat=pargs.r.ret_int; break;
|
||||
case oCommandFD:
|
||||
opt.command_fd = translate_sys2libc_fd_int (pargs.r.ret_int, 0);
|
||||
break;
|
||||
case oCommandFile:
|
||||
opt.command_fd = open_info_file (pargs.r.ret_str, 0);
|
||||
opt.command_fd = open_info_file (pargs.r.ret_str, 0, 1);
|
||||
break;
|
||||
case oCipherAlgo:
|
||||
def_cipher_string = xstrdup(pargs.r.ret_str);
|
||||
|
|
|
@ -147,10 +147,10 @@ main( int argc, char **argv )
|
|||
log_set_prefix ("gpgv", 1);
|
||||
|
||||
/* Make sure that our subsystems are ready. */
|
||||
i18n_init();
|
||||
init_common_subsystems ();
|
||||
|
||||
gnupg_init_signals (0, NULL);
|
||||
i18n_init();
|
||||
|
||||
opt.command_fd = -1; /* no command fd */
|
||||
opt.pgp2_workarounds = 1;
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
#include <fcntl.h> /* for setmode() */
|
||||
#endif
|
||||
|
||||
#include "gpg.h"
|
||||
#include "options.h"
|
||||
|
@ -50,7 +53,8 @@ struct sig_stats
|
|||
int oth_err;
|
||||
};
|
||||
|
||||
static FILE *attrib_fp=NULL;
|
||||
/* The stream used to write attribute packets to. */
|
||||
static FILE *attrib_fp = NULL;
|
||||
|
||||
/****************
|
||||
* List the keys
|
||||
|
@ -745,6 +749,7 @@ dump_attribs(const PKT_user_id *uid,PKT_public_key *pk,PKT_secret_key *sk)
|
|||
}
|
||||
|
||||
fwrite(uid->attribs[i].data,uid->attribs[i].len,1,attrib_fp);
|
||||
fflush (attrib_fp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1609,29 +1614,35 @@ print_card_serialno (PKT_secret_key *sk)
|
|||
|
||||
|
||||
|
||||
void set_attrib_fd(int fd)
|
||||
void
|
||||
set_attrib_fd (int fd)
|
||||
{
|
||||
static int last_fd=-1;
|
||||
|
||||
if ( fd != -1 && last_fd == fd )
|
||||
return;
|
||||
|
||||
if ( attrib_fp && attrib_fp != stdout && attrib_fp != stderr )
|
||||
if ( attrib_fp && attrib_fp != stdout && attrib_fp != stderr
|
||||
&& attrib_fp != log_get_stream () )
|
||||
fclose (attrib_fp);
|
||||
attrib_fp = NULL;
|
||||
if ( fd == -1 )
|
||||
return;
|
||||
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
setmode ( fileno(fp) , O_BINARY );
|
||||
#endif
|
||||
if( fd == 1 )
|
||||
attrib_fp = stdout;
|
||||
else if( fd == 2 )
|
||||
attrib_fp = stderr;
|
||||
else
|
||||
attrib_fp = fdopen( fd, "wb" );
|
||||
if( !attrib_fp ) {
|
||||
log_fatal("can't open fd %d for attribute output: %s\n",
|
||||
fd, strerror(errno));
|
||||
}
|
||||
|
||||
attrib_fp = fdopen (fd, "wb");
|
||||
if (!attrib_fp)
|
||||
{
|
||||
log_fatal("can't open fd %d for attribute output: %s\n",
|
||||
fd, strerror(errno));
|
||||
}
|
||||
|
||||
last_fd = fd;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue