diff options
author | Werner Koch <[email protected]> | 2010-03-08 17:05:37 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2010-03-08 17:05:37 +0000 |
commit | 40a78fab0c224bfb92097a6d7f93c0893740d190 (patch) | |
tree | 3d8b2bb9ad0346fa80f04cf7bab3181d55bff31e /g10 | |
parent | More cleanups (diff) | |
download | gnupg-40a78fab0c224bfb92097a6d7f93c0893740d190.tar.gz gnupg-40a78fab0c224bfb92097a6d7f93c0893740d190.zip |
Use macros for iobuf ioctls.
Diffstat (limited to 'g10')
-rw-r--r-- | g10/ChangeLog | 4 | ||||
-rw-r--r-- | g10/decrypt.c | 2 | ||||
-rw-r--r-- | g10/encrypt.c | 4 | ||||
-rw-r--r-- | g10/exec.c | 6 | ||||
-rw-r--r-- | g10/import.c | 3 | ||||
-rw-r--r-- | g10/keydb.c | 2 | ||||
-rw-r--r-- | g10/keyedit.c | 2 | ||||
-rw-r--r-- | g10/keygen.c | 16 | ||||
-rw-r--r-- | g10/keyring.c | 8 | ||||
-rw-r--r-- | g10/openfile.c | 2 | ||||
-rw-r--r-- | g10/verify.c | 2 |
11 files changed, 30 insertions, 21 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 63741015a..e1837bb19 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,7 @@ +2010-03-08 Werner Koch <[email protected]> + + Use macros for iobuf_ioctl commands. + 2010-02-17 Werner Koch <[email protected]> * keygen.c (ask_user_id): Avoid infinite loop in case of invalid diff --git a/g10/decrypt.c b/g10/decrypt.c index 68b668864..ef7966d79 100644 --- a/g10/decrypt.c +++ b/g10/decrypt.c @@ -223,7 +223,7 @@ decrypt_messages (int nfiles, char *files[]) goto next_file; fp = iobuf_open(filename); if (fp) - iobuf_ioctl (fp,3,1,NULL); /* disable fd caching */ + iobuf_ioctl (fp, IOBUF_IOCTL_NO_CACHE, 1, NULL); if (fp && is_secured_file (iobuf_get_fd (fp))) { iobuf_close (fp); diff --git a/g10/encrypt.c b/g10/encrypt.c index 649ea337f..b193d4b4e 100644 --- a/g10/encrypt.c +++ b/g10/encrypt.c @@ -185,7 +185,7 @@ encrypt_simple (const char *filename, int mode, int use_seskey) /* Prepare iobufs. */ inp = iobuf_open(filename); if (inp) - iobuf_ioctl (inp,3,1,NULL); /* disable fd caching */ + iobuf_ioctl (inp, IOBUF_IOCTL_NO_CACHE, 1, NULL); if (inp && is_secured_file (iobuf_get_fd (inp))) { iobuf_close (inp); @@ -526,7 +526,7 @@ encrypt_crypt (int filefd, const char *filename, /* Prepare iobufs. */ inp = iobuf_open_fd_or_name (filefd, filename, "rb"); if (inp) - iobuf_ioctl (inp, 3, 1, NULL); /* Disable fd caching. */ + iobuf_ioctl (inp, IOBUF_IOCTL_NO_CACHE, 1, NULL); if (inp && is_secured_file (iobuf_get_fd (inp))) { iobuf_close (inp); diff --git a/g10/exec.c b/g10/exec.c index 6ab24793f..46a2c600d 100644 --- a/g10/exec.c +++ b/g10/exec.c @@ -449,8 +449,8 @@ exec_write(struct exec_info **info,const char *program, goto fail; } - /* fd iobufs are cached?! */ - iobuf_ioctl((*info)->fromchild,3,1,NULL); + /* fd iobufs are cached! */ + iobuf_ioctl((*info)->fromchild, IOBUF_IOCTL_NO_CACHE, 1, NULL); return 0; } @@ -556,7 +556,7 @@ exec_read(struct exec_info *info) } /* Do not cache this iobuf on close */ - iobuf_ioctl(info->fromchild,3,1,NULL); + iobuf_ioctl(info->fromchild, IOBUF_IOCTL_NO_CACHE, 1, NULL); } } diff --git a/g10/import.c b/g10/import.c index 88eb24e57..8de1d29f0 100644 --- a/g10/import.c +++ b/g10/import.c @@ -196,7 +196,8 @@ import_keys_internal( IOBUF inp, char **fnames, int nnames, rc = import( inp2, fname, stats, fpr, fpr_len, options ); iobuf_close(inp2); /* Must invalidate that ugly cache to actually close it. */ - iobuf_ioctl (NULL, 2, 0, (char*)fname); + iobuf_ioctl (NULL, IOBUF_IOCTL_INVALIDATE_CACHE, + 0, (char*)fname); if( rc ) log_error("import from `%s' failed: %s\n", fname, g10_errstr(rc) ); diff --git a/g10/keydb.c b/g10/keydb.c index 41b8c1d33..9c26a099b 100644 --- a/g10/keydb.c +++ b/g10/keydb.c @@ -188,7 +188,7 @@ maybe_create_keyring (char *filename, int force) iobuf_close (iobuf); /* Must invalidate that ugly cache */ - iobuf_ioctl (NULL, 2, 0, filename); + iobuf_ioctl (NULL, IOBUF_IOCTL_INVALIDATE_CACHE, 0, filename); rc = 0; leave: diff --git a/g10/keyedit.c b/g10/keyedit.c index 72f9c0268..270b3bacb 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -1981,7 +1981,7 @@ keyedit_menu( const char *username, strlist_t locusr, init_packet (pkt); rc = parse_packet (a, pkt); iobuf_close (a); - iobuf_ioctl (NULL, 2, 0, (char*)fname); /* (invalidate cache). */ + iobuf_ioctl (NULL, IOBUF_IOCTL_INVALIDATE_CACHE, 0, (char*)fname); if (!rc && pkt->pkttype != PKT_SECRET_KEY && pkt->pkttype != PKT_SECRET_SUBKEY) diff --git a/g10/keygen.c b/g10/keygen.c index efef372a0..9d5d39d64 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -2877,7 +2877,7 @@ read_parameter_file( const char *fname ) log_error (_("can't open `%s': %s\n"), fname, strerror(errno) ); return; } - iobuf_ioctl (fp, 3, 1, NULL); /* No file caching. */ + iobuf_ioctl (fp, IOBUF_IOCTL_NO_CACHE, 1, NULL); lnr = 0; err = NULL; @@ -3018,9 +3018,11 @@ read_parameter_file( const char *fname ) /* Must invalidate that ugly cache to actually close it. */ if (outctrl.pub.fname) - iobuf_ioctl (NULL, 2, 0, (char*)outctrl.pub.fname); + iobuf_ioctl (NULL, IOBUF_IOCTL_INVALIDATE_CACHE, + 0, (char*)outctrl.pub.fname); if (outctrl.sec.fname) - iobuf_ioctl (NULL, 2, 0, (char*)outctrl.sec.fname); + iobuf_ioctl (NULL, IOBUF_IOCTL_INVALIDATE_CACHE, + 0, (char*)outctrl.sec.fname); xfree( outctrl.pub.fname ); xfree( outctrl.pub.newfname ); @@ -3377,7 +3379,8 @@ do_generate_keypair (struct para_data_s *para, iobuf_close(outctrl->pub.stream); outctrl->pub.stream = NULL; if (outctrl->pub.fname) - iobuf_ioctl (NULL, 2, 0, (char*)outctrl->pub.fname); + iobuf_ioctl (NULL, IOBUF_IOCTL_INVALIDATE_CACHE, + 0, (char*)outctrl->pub.fname); xfree( outctrl->pub.fname ); outctrl->pub.fname = outctrl->pub.newfname; outctrl->pub.newfname = NULL; @@ -3408,7 +3411,8 @@ do_generate_keypair (struct para_data_s *para, iobuf_close(outctrl->sec.stream); outctrl->sec.stream = NULL; if (outctrl->sec.fname) - iobuf_ioctl (NULL, 2, 0, (char*)outctrl->sec.fname); + iobuf_ioctl (NULL, IOBUF_IOCTL_INVALIDATE_CACHE, + 0, (char*)outctrl->sec.fname); xfree( outctrl->sec.fname ); outctrl->sec.fname = outctrl->sec.newfname; outctrl->sec.newfname = NULL; @@ -4187,7 +4191,7 @@ gen_card_key_with_backup (int algo, int keyno, int is_primary, char *fprbuf, *p; iobuf_close (fp); - iobuf_ioctl (NULL, 2, 0, (char*)fname); + iobuf_ioctl (NULL, IOBUF_IOCTL_INVALIDATE_CACHE, 0, (char*)fname); log_info (_("NOTE: backup of card key saved to `%s'\n"), fname); fingerprint_from_sk (sk, array, &n); diff --git a/g10/keyring.c b/g10/keyring.c index fd0dc2d89..72e3ed5a8 100644 --- a/g10/keyring.c +++ b/g10/keyring.c @@ -1255,20 +1255,20 @@ rename_tmp_file (const char *bakfname, const char *tmpfname, /* It's a secret keyring, so let's force a fsync just to be safe on filesystems that may not sync data and metadata together (e.g. ext4). */ - if (secret && iobuf_ioctl (NULL, 4, 0, (char*)tmpfname)) + if (secret && iobuf_ioctl (NULL, IOBUF_IOCTL_FSYNC, 0, (char*)tmpfname)) { rc = gpg_error_from_syserror (); goto fail; } /* Invalidate close caches. */ - if (iobuf_ioctl (NULL, 2, 0, (char*)tmpfname )) + if (iobuf_ioctl (NULL, IOBUF_IOCTL_INVALIDATE_CACHE, 0, (char*)tmpfname )) { rc = gpg_error_from_syserror (); goto fail; } - iobuf_ioctl (NULL, 2, 0, (char*)bakfname ); - iobuf_ioctl (NULL, 2, 0, (char*)fname ); + iobuf_ioctl (NULL, IOBUF_IOCTL_INVALIDATE_CACHE, 0, (char*)bakfname ); + iobuf_ioctl (NULL, IOBUF_IOCTL_INVALIDATE_CACHE, 0, (char*)fname ); /* first make a backup file except for secret keyrings */ if (!secret) diff --git a/g10/openfile.c b/g10/openfile.c index 9f41273e0..4b7fe3600 100644 --- a/g10/openfile.c +++ b/g10/openfile.c @@ -305,7 +305,7 @@ open_outfile (int inp_fd, const char *iname, int mode, iobuf_t *a) } if (*a) - iobuf_ioctl (*a, 3, 1, NULL); /* Disable fd caching. */ + iobuf_ioctl (*a, IOBUF_IOCTL_NO_CACHE, 1, NULL); return rc; } diff --git a/g10/verify.c b/g10/verify.c index 484fd9c76..9ca5591bc 100644 --- a/g10/verify.c +++ b/g10/verify.c @@ -150,7 +150,7 @@ verify_one_file( const char *name ) print_file_status( STATUS_FILE_START, name, 1 ); fp = iobuf_open(name); if (fp) - iobuf_ioctl (fp,3,1,NULL); /* disable fd caching */ + iobuf_ioctl (fp, IOBUF_IOCTL_NO_CACHE, 1, NULL); if (fp && is_secured_file (iobuf_get_fd (fp))) { iobuf_close (fp); |