mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-02 12:01:32 +01:00
gpg: Use gnupg_fd_t for open_outfile.
* g10/main.h (open_outfile): Use gnupg_fd_t instead of int. * g10/openfile.c (open_outfile): Likewise. Use GNUPG_INVALID_FD. * g10/dearmor.c (dearmor_file, enarmor_file): Follow the change. * g10/encrypt.c (encrypt_simple): Likewise. * g10/export.c (do_export): Likewise. * g10/revoke.c (gen_desig_revoke, create_revocation): Likewise. * g10/sign.c (sign_file, clearsign_file, sign_symencrypt_file): Likewise. -- GnuPG-bug-id: 6580 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
dc13361524
commit
68d3a73ea7
@ -63,7 +63,7 @@ dearmor_file( const char *fname )
|
|||||||
|
|
||||||
push_armor_filter ( afx, inp );
|
push_armor_filter ( afx, inp );
|
||||||
|
|
||||||
if( (rc = open_outfile (-1, fname, 0, 0, &out)) )
|
if( (rc = open_outfile (GNUPG_INVALID_FD, fname, 0, 0, &out)) )
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
iobuf_copy (out, inp);
|
iobuf_copy (out, inp);
|
||||||
@ -107,7 +107,7 @@ enarmor_file( const char *fname )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( (rc = open_outfile (-1, fname, 1, 0, &out )) )
|
if( (rc = open_outfile (GNUPG_INVALID_FD, fname, 1, 0, &out )) )
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
afx->what = 4;
|
afx->what = 4;
|
||||||
|
@ -507,7 +507,8 @@ encrypt_simple (const char *filename, int mode, int use_seskey)
|
|||||||
/**/ : "CFB");
|
/**/ : "CFB");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( rc || (rc = open_outfile (-1, filename, opt.armor? 1:0, 0, &out )))
|
if (rc || (rc = open_outfile (GNUPG_INVALID_FD, filename, opt.armor? 1:0,
|
||||||
|
0, &out )))
|
||||||
{
|
{
|
||||||
iobuf_cancel (inp);
|
iobuf_cancel (inp);
|
||||||
xfree (cfx.dek);
|
xfree (cfx.dek);
|
||||||
|
@ -426,7 +426,7 @@ do_export (ctrl_t ctrl, strlist_t users, int secret, unsigned int options,
|
|||||||
|
|
||||||
memset( &zfx, 0, sizeof zfx);
|
memset( &zfx, 0, sizeof zfx);
|
||||||
|
|
||||||
rc = open_outfile (-1, NULL, 0, !!secret, &out );
|
rc = open_outfile (GNUPG_INVALID_FD, NULL, 0, !!secret, &out);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ gpg_error_t generate_card_subkeypair (ctrl_t ctrl, kbnode_t pub_keyblock,
|
|||||||
int overwrite_filep( const char *fname );
|
int overwrite_filep( const char *fname );
|
||||||
char *make_outfile_name( const char *iname );
|
char *make_outfile_name( const char *iname );
|
||||||
char *ask_outfile_name( const char *name, size_t namelen );
|
char *ask_outfile_name( const char *name, size_t namelen );
|
||||||
int open_outfile (int out_fd, const char *iname, int mode,
|
int open_outfile (gnupg_fd_t out_fd, const char *iname, int mode,
|
||||||
int restrictedperm, iobuf_t *a);
|
int restrictedperm, iobuf_t *a);
|
||||||
char *get_matching_datafile (const char *sigfilename);
|
char *get_matching_datafile (const char *sigfilename);
|
||||||
iobuf_t open_sigfile (const char *sigfilename, progress_filter_context_t *pfx);
|
iobuf_t open_sigfile (const char *sigfilename, progress_filter_context_t *pfx);
|
||||||
|
@ -179,13 +179,13 @@ ask_outfile_name( const char *name, size_t namelen )
|
|||||||
* be closed if the returned IOBUF is closed. This is used for gpg's
|
* be closed if the returned IOBUF is closed. This is used for gpg's
|
||||||
* --server mode. */
|
* --server mode. */
|
||||||
int
|
int
|
||||||
open_outfile (int out_fd, const char *iname, int mode, int restrictedperm,
|
open_outfile (gnupg_fd_t out_fd, const char *iname, int mode,
|
||||||
iobuf_t *a)
|
int restrictedperm, iobuf_t *a)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
*a = NULL;
|
*a = NULL;
|
||||||
if (out_fd != -1)
|
if (out_fd != GNUPG_INVALID_FD)
|
||||||
{
|
{
|
||||||
char xname[64];
|
char xname[64];
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ gen_desig_revoke (ctrl_t ctrl, const char *uname, strlist_t locusr)
|
|||||||
if( !opt.armor )
|
if( !opt.armor )
|
||||||
tty_printf(_("ASCII armored output forced.\n"));
|
tty_printf(_("ASCII armored output forced.\n"));
|
||||||
|
|
||||||
if( (rc = open_outfile (-1, NULL, 0, 1, &out )) )
|
if( (rc = open_outfile (GNUPG_INVALID_FD, NULL, 0, 1, &out )) )
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
afx->what = 1;
|
afx->what = 1;
|
||||||
@ -464,7 +464,7 @@ create_revocation (ctrl_t ctrl,
|
|||||||
|
|
||||||
afx = new_armor_context ();
|
afx = new_armor_context ();
|
||||||
|
|
||||||
if ((rc = open_outfile (-1, filename, suffix, 1, &out)))
|
if ((rc = open_outfile (GNUPG_INVALID_FD, filename, suffix, 1, &out)))
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
if (leadintext )
|
if (leadintext )
|
||||||
|
@ -1113,7 +1113,7 @@ sign_file (ctrl_t ctrl, strlist_t filenames, int detached, strlist_t locusr,
|
|||||||
else if (opt.verbose)
|
else if (opt.verbose)
|
||||||
log_info (_("writing to '%s'\n"), outfile);
|
log_info (_("writing to '%s'\n"), outfile);
|
||||||
}
|
}
|
||||||
else if ((rc = open_outfile (-1, fname,
|
else if ((rc = open_outfile (GNUPG_INVALID_FD, fname,
|
||||||
opt.armor? 1 : detached? 2 : 0, 0, &out)))
|
opt.armor? 1 : detached? 2 : 0, 0, &out)))
|
||||||
{
|
{
|
||||||
goto leave;
|
goto leave;
|
||||||
@ -1459,7 +1459,7 @@ clearsign_file (ctrl_t ctrl,
|
|||||||
log_info (_("writing to '%s'\n"), outfile);
|
log_info (_("writing to '%s'\n"), outfile);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ((rc = open_outfile (-1, fname, 1, 0, &out)))
|
else if ((rc = open_outfile (GNUPG_INVALID_FD, fname, 1, 0, &out)))
|
||||||
{
|
{
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
@ -1637,7 +1637,7 @@ sign_symencrypt_file (ctrl_t ctrl, const char *fname, strlist_t locusr)
|
|||||||
/**/ : "CFB");
|
/**/ : "CFB");
|
||||||
|
|
||||||
/* Now create the outfile. */
|
/* Now create the outfile. */
|
||||||
rc = open_outfile (-1, fname, opt.armor? 1:0, 0, &out);
|
rc = open_outfile (GNUPG_INVALID_FD, fname, opt.armor? 1:0, 0, &out);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user