diff options
author | Werner Koch <wk@gnupg.org> | 2010-04-01 15:24:55 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2010-04-01 15:24:55 +0200 |
commit | f3839fe81ddd86632c1a4d70986bbe7e3a751fc2 (patch) | |
tree | 6fa1386cb24d9477a4d7ca95f6230baa5be6589f | |
parent | Minor cleanups (diff) | |
download | gnupg2-f3839fe81ddd86632c1a4d70986bbe7e3a751fc2.tar.xz gnupg2-f3839fe81ddd86632c1a4d70986bbe7e3a751fc2.zip |
Use gpg_err_set_errno to assign values to ERRNO.
-rw-r--r-- | g10/ChangeLog | 4 | ||||
-rw-r--r-- | g10/dearmor.c | 4 | ||||
-rw-r--r-- | g10/decrypt.c | 6 | ||||
-rw-r--r-- | g10/encrypt.c | 4 | ||||
-rw-r--r-- | g10/exec.c | 4 | ||||
-rw-r--r-- | g10/gpg.c | 8 | ||||
-rw-r--r-- | g10/import.c | 2 | ||||
-rw-r--r-- | g10/keydb.c | 2 | ||||
-rw-r--r-- | g10/keyedit.c | 2 | ||||
-rw-r--r-- | g10/keygen.c | 8 | ||||
-rw-r--r-- | g10/keyring.c | 4 | ||||
-rw-r--r-- | g10/openfile.c | 8 | ||||
-rw-r--r-- | g10/photoid.c | 2 | ||||
-rw-r--r-- | g10/plaintext.c | 8 | ||||
-rw-r--r-- | g10/sign.c | 12 | ||||
-rw-r--r-- | g10/tdbdump.c | 2 | ||||
-rw-r--r-- | g10/tdbio.c | 2 | ||||
-rw-r--r-- | g10/verify.c | 4 |
18 files changed, 45 insertions, 41 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 6def55468..52fcf4b8e 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,7 @@ +2010-04-01 Werner Koch <wk@g10code.com> + + Use gpg_err_set_errno to set ERRNO. + 2010-03-26 Werner Koch <wk@g10code.com> * signal.c (pause_on_sigusr): Remove. It was used in ancient gpg diff --git a/g10/dearmor.c b/g10/dearmor.c index 00bdf7bbd..04b9e61bf 100644 --- a/g10/dearmor.c +++ b/g10/dearmor.c @@ -53,7 +53,7 @@ dearmor_file( const char *fname ) { iobuf_close (inp); inp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if (!inp) { rc = gpg_error_from_syserror (); @@ -100,7 +100,7 @@ enarmor_file( const char *fname ) { iobuf_close (inp); inp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if (!inp) { rc = gpg_error_from_syserror (); diff --git a/g10/decrypt.c b/g10/decrypt.c index ef7966d79..82eefcccc 100644 --- a/g10/decrypt.c +++ b/g10/decrypt.c @@ -59,7 +59,7 @@ decrypt_message (const char *filename) { iobuf_close (fp); fp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if ( !fp ) { @@ -118,7 +118,7 @@ decrypt_message_fd (int input_fd, int output_fd) { iobuf_close (fp); fp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if (!fp) { @@ -228,7 +228,7 @@ decrypt_messages (int nfiles, char *files[]) { iobuf_close (fp); fp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if (!fp) { diff --git a/g10/encrypt.c b/g10/encrypt.c index b193d4b4e..881fecfc1 100644 --- a/g10/encrypt.c +++ b/g10/encrypt.c @@ -190,7 +190,7 @@ encrypt_simple (const char *filename, int mode, int use_seskey) { iobuf_close (inp); inp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if (!inp) { @@ -531,7 +531,7 @@ encrypt_crypt (int filefd, const char *filename, { iobuf_close (inp); inp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if (!inp) { diff --git a/g10/exec.c b/g10/exec.c index 46a2c600d..8f26edadf 100644 --- a/g10/exec.c +++ b/g10/exec.c @@ -463,7 +463,7 @@ exec_write(struct exec_info **info,const char *program, if( is_secured_filename ((*info)->tempfile_in) ) { (*info)->tochild = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } else (*info)->tochild=fopen((*info)->tempfile_in,binary?"wb":"w"); @@ -545,7 +545,7 @@ exec_read(struct exec_info *info) { iobuf_close (info->fromchild); info->fromchild = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if(info->fromchild==NULL) { @@ -1107,7 +1107,7 @@ open_info_file (const char *fname, int for_write, int binary) /* if (is_secured_filename (fname)) */ /* { */ /* fd = -1; */ -/* errno = EPERM; */ +/* gpg_err_set_errno (EPERM); */ /* } */ /* else */ /* { */ @@ -2108,7 +2108,7 @@ main (int argc, char **argv) { fclose (configfp); configfp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if( !configfp ) { if( default_config ) { @@ -4037,7 +4037,7 @@ main (int argc, char **argv) { iobuf_close (a); a = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if( !a ) log_error(_("can't open `%s'\n"), print_fname_stdin(fname)); @@ -4224,7 +4224,7 @@ print_mds( const char *fname, int algo ) { fclose (fp); fp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } } if( !fp ) { diff --git a/g10/import.c b/g10/import.c index a46542f65..c1ff93c0f 100644 --- a/g10/import.c +++ b/g10/import.c @@ -187,7 +187,7 @@ import_keys_internal( IOBUF inp, char **fnames, int nnames, { iobuf_close (inp2); inp2 = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if( !inp2 ) log_error(_("can't open `%s': %s\n"), fname, strerror(errno) ); diff --git a/g10/keydb.c b/g10/keydb.c index 9c26a099b..a50a5a9d0 100644 --- a/g10/keydb.c +++ b/g10/keydb.c @@ -170,7 +170,7 @@ maybe_create_keyring (char *filename, int force) if (is_secured_filename (filename)) { iobuf = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } else iobuf = iobuf_create (filename); diff --git a/g10/keyedit.c b/g10/keyedit.c index e9b92b232..a5a3be068 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -1971,7 +1971,7 @@ keyedit_menu( const char *username, strlist_t locusr, { iobuf_close (a); a = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if (!a) { diff --git a/g10/keygen.c b/g10/keygen.c index 9d5d39d64..5b625dba1 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -2871,7 +2871,7 @@ read_parameter_file( const char *fname ) { iobuf_close (fp); fp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if (!fp) { log_error (_("can't open `%s': %s\n"), fname, strerror(errno) ); @@ -3388,7 +3388,7 @@ do_generate_keypair (struct para_data_s *para, if (is_secured_filename (outctrl->pub.fname) ) { outctrl->pub.stream = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } else outctrl->pub.stream = iobuf_create( outctrl->pub.fname ); @@ -3421,7 +3421,7 @@ do_generate_keypair (struct para_data_s *para, if (is_secured_filename (outctrl->sec.fname) ) { outctrl->sec.stream = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } else outctrl->sec.stream = iobuf_create( outctrl->sec.fname ); @@ -4158,7 +4158,7 @@ gen_card_key_with_backup (int algo, int keyno, int is_primary, if (is_secured_filename (fname)) { fp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } else fp = iobuf_create (fname); diff --git a/g10/keyring.c b/g10/keyring.c index 72e3ed5a8..bef9b932b 100644 --- a/g10/keyring.c +++ b/g10/keyring.c @@ -1226,7 +1226,7 @@ create_tmp_file (const char *template, if (is_secured_filename (tmpfname)) { *r_fp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } else *r_fp = iobuf_create (tmpfname); @@ -1558,7 +1558,7 @@ do_copy (int mode, const char *fname, KBNODE root, int secret, oldmask=umask(077); if (!secret && is_secured_filename (fname)) { newfp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } else newfp = iobuf_create (fname); diff --git a/g10/openfile.c b/g10/openfile.c index b1cd294c1..eb12f0482 100644 --- a/g10/openfile.c +++ b/g10/openfile.c @@ -284,7 +284,7 @@ open_outfile (int inp_fd, const char *iname, int mode, iobuf_t *a) if (is_secured_filename (name) ) { *a = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } else *a = iobuf_create (name); @@ -329,7 +329,7 @@ open_sigfile( const char *iname, progress_filter_context_t *pfx ) { iobuf_close (a); a = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if( a && opt.verbose ) log_info(_("assuming signed data in `%s'\n"), buf ); @@ -366,7 +366,7 @@ copy_options_file( const char *destdir ) { fclose (src); src = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if( !src ) { log_info (_("can't open `%s': %s\n"), fname, strerror(errno) ); @@ -378,7 +378,7 @@ copy_options_file( const char *destdir ) if ( is_secured_filename (fname) ) { dst = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } else dst = fopen( fname, "w" ); diff --git a/g10/photoid.c b/g10/photoid.c index 1ac1218d7..66e4645f9 100644 --- a/g10/photoid.c +++ b/g10/photoid.c @@ -110,7 +110,7 @@ generate_photo_id(PKT_public_key *pk,const char *photo_name) { iobuf_close (file); file = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if(!file) { diff --git a/g10/plaintext.c b/g10/plaintext.c index 0a7415c9e..85f7165bd 100644 --- a/g10/plaintext.c +++ b/g10/plaintext.c @@ -158,7 +158,7 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx, ; else if (is_secured_filename (fname)) { - errno = EPERM; + gpg_err_set_errno (EPERM); rc = gpg_error_from_syserror (); log_error (_("error creating `%s': %s\n"), fname, strerror (errno)); goto leave; @@ -548,7 +548,7 @@ ask_for_detached_datafile (gcry_md_hd_t md, gcry_md_hd_t md2, { iobuf_close (fp); fp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if (!fp && errno == ENOENT) { @@ -622,7 +622,7 @@ hash_datafiles (gcry_md_hd_t md, gcry_md_hd_t md2, strlist_t files, { iobuf_close (fp); fp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if (!fp) { @@ -654,7 +654,7 @@ hash_datafile_by_fd (gcry_md_hd_t md, gcry_md_hd_t md2, int data_fd, if (is_secured_file (data_fd)) { fp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } else fp = iobuf_fdopen_nc (data_fd, "rb"); diff --git a/g10/sign.c b/g10/sign.c index 604802577..d06a9cc5f 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -783,7 +783,7 @@ sign_file( strlist_t filenames, int detached, strlist_t locusr, { iobuf_close (inp); inp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if( !inp ) { @@ -799,7 +799,7 @@ sign_file( strlist_t filenames, int detached, strlist_t locusr, if( outfile ) { if (is_secured_filename ( outfile )) { out = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } else out = iobuf_create( outfile ); @@ -978,7 +978,7 @@ sign_file( strlist_t filenames, int detached, strlist_t locusr, { iobuf_close (inp); inp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if( !inp ) { @@ -1095,7 +1095,7 @@ clearsign_file( const char *fname, strlist_t locusr, const char *outfile ) { iobuf_close (inp); inp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if( !inp ) { rc = gpg_error_from_syserror (); @@ -1108,7 +1108,7 @@ clearsign_file( const char *fname, strlist_t locusr, const char *outfile ) if( outfile ) { if (is_secured_filename (outfile) ) { outfile = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } else out = iobuf_create( outfile ); @@ -1250,7 +1250,7 @@ sign_symencrypt_file (const char *fname, strlist_t locusr) { iobuf_close (inp); inp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if( !inp ) { rc = gpg_error_from_syserror (); diff --git a/g10/tdbdump.c b/g10/tdbdump.c index 4c3b888cb..b68cde2f6 100644 --- a/g10/tdbdump.c +++ b/g10/tdbdump.c @@ -146,7 +146,7 @@ import_ownertrust( const char *fname ) if (is_secured_file (fileno (fp))) { fclose (fp); - errno = EPERM; + gpg_err_set_errno (EPERM); log_error (_("can't open `%s': %s\n"), fname, strerror(errno) ); return; } diff --git a/g10/tdbio.c b/g10/tdbio.c index c364cb582..f967742c3 100644 --- a/g10/tdbio.c +++ b/g10/tdbio.c @@ -539,7 +539,7 @@ tdbio_set_dbname( const char *new_dbname, int create ) oldmask=umask(077); if (is_secured_filename (fname)) { fp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } else fp =fopen( fname, "wb" ); diff --git a/g10/verify.c b/g10/verify.c index 253a5920b..4dab20717 100644 --- a/g10/verify.c +++ b/g10/verify.c @@ -91,7 +91,7 @@ verify_signatures( int nfiles, char **files ) { iobuf_close (fp); fp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if( !fp ) { rc = gpg_error_from_syserror (); @@ -154,7 +154,7 @@ verify_one_file( const char *name ) { iobuf_close (fp); fp = NULL; - errno = EPERM; + gpg_err_set_errno (EPERM); } if( !fp ) { rc = gpg_error_from_syserror (); |