aboutsummaryrefslogtreecommitdiff
path: root/src/gpg.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-04-13 21:50:15 +0300
committerSergey Poznyakoff <gray@gnu.org>2020-04-13 22:32:40 +0300
commit2f3ec2402f827066cb55ae562154106433d29ac2 (patch)
tree87e650e32e90da305478c17e1e9730932e4e3c50 /src/gpg.c
parenta9d38e5de5cceb667bec3db15fed68f7e8d96a8b (diff)
downloadwydawca-2f3ec2402f827066cb55ae562154106433d29ac2.tar.gz
wydawca-2f3ec2402f827066cb55ae562154106433d29ac2.tar.bz2
Rewrite diskio function so as not to assume any particular cwd
* src/backup.c (get_backup_suffix) (find_backup_file_name): Get directory descriptor as first argument. * src/diskio.c: Rewrite using *at() functions. * src/gpg.c (rmdir_r): Silently skip ENOENT. (verify_detached_signature): push_dir/pop_dir. * src/triplet.c: Don't change to spool->source_dir. Underlying functions don't assume any specific cwd. * src/wydawca.h (find_backup_file_name) (create_hierarchy): Change signatures. All uses changed. * tests/Makefile.am: Add new tests. * tests/testsuite.at: Likewise. (AT_WYDAWCA_DAEMON): Take additional argument. * tests/inotify-rmsymlink.at: New test. * tests/inotify-symlink.at: New test. * tests/rmsymlink00.at: New test. * tests/symlink00.at: New test. * tests/symlink01.at: New test. * tests/dist/rmsymlink.directive.asc: New directive file. * tests/dist/symlink.directive.asc: New directive file.
Diffstat (limited to 'src/gpg.c')
-rw-r--r--src/gpg.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gpg.c b/src/gpg.c
index dd15927..62fe456 100644
--- a/src/gpg.c
+++ b/src/gpg.c
@@ -100,7 +100,7 @@ rmdir_r(const char *name)
rc = 1;
}
- if (rc == 0 && rmdir(name)) {
+ if (rc == 0 && rmdir(name) && errno != ENOENT) {
wy_log(LOG_ERR, _("cannot remove directory %s: %s"),
name, strerror(errno));
return 1;
@@ -302,7 +302,8 @@ verify_detached_signature(struct wy_triplet *trp)
gpgme_engine_info_t info;
const char *argv[5];
const struct spool *spool;
-
+ int rc;
+
ASGN_SPOOL(spool, trp, return 1);
fail_if_err(gpgme_get_engine_info(&info));
@@ -322,10 +323,13 @@ verify_detached_signature(struct wy_triplet *trp)
argv[3] = trp->file[file_dist].name;
argv[4] = NULL;
+ push_dir(trp->spool->source_dir);
+ rc = 1;
switch (wydawca_exec(5, argv, NULL)) {
case exec_success:
wy_debug(1, (_("good detached signature for %s"), trp->name));
- return 0;
+ rc = 0;
+ break;
case exec_fail:
UPDATE_STATS(WY_STAT_BAD_SIGNATURE);
@@ -338,6 +342,7 @@ verify_detached_signature(struct wy_triplet *trp)
trp->name);
break;
}
+ pop_dir();
- return 1;
+ return rc;
}

Return to:

Send suggestions and report system problems to the System administrator.