aboutsummaryrefslogtreecommitdiff
path: root/src/triplet.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/triplet.c')
-rw-r--r--src/triplet.c58
1 files changed, 23 insertions, 35 deletions
diff --git a/src/triplet.c b/src/triplet.c
index f2c2184..ded09c8 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -241,9 +241,7 @@ triplet_expired_p(struct file_triplet *trp)
for (i = 0; i < FILE_TYPE_COUNT; i++) {
if (trp->file[i].name
&& (now - trp->file[i].sb.st_mtime) >= ttl) {
- if (wy_debug_level)
- logmsg(LOG_DEBUG, _("file %s expired"),
- trp->file[i].name);
+ wy_debug(1, (_("file %s expired"), trp->file[i].name));
return 1;
}
}
@@ -280,11 +278,9 @@ check_triplet_state(struct file_triplet *trp, int noauth)
trp->file[file_directive].sb.st_uid)
return triplet_complete;
else {
- if (wy_debug_level)
- logmsg(LOG_DEBUG,
- _("%s: invalid triplet: "
- "UIDs differ"),
- trp->name);
+ wy_debug(1, (_("%s: invalid triplet: "
+ "UIDs differ"),
+ trp->name));
return triplet_bad;
}
}
@@ -303,16 +299,16 @@ remove_triplet(struct file_triplet *trp, int check)
if (trp->file[i].name) {
if (check) {
if (access(trp->file[i].name, F_OK) == 0) {
- logmsg(LOG_NOTICE,
+ wy_log(LOG_NOTICE,
_("%s still exists"),
trp->file[i].name);
return 1;
}
} else {
- logmsg(LOG_NOTICE, _("removing %s"),
+ wy_log(LOG_NOTICE, _("removing %s"),
trp->file[i].name);
if (!dry_run_mode && unlink(trp->file[i].name))
- logmsg(LOG_ERR,
+ wy_log(LOG_ERR,
_("cannot remove %s: %s"),
trp->file[i].name,
strerror(errno));
@@ -340,27 +336,22 @@ triplet_processor(void *data, void *proc_data)
{
struct file_triplet *trp = data;
- if (wy_debug_level)
- logmsg(LOG_DEBUG, "FILE %s, DIST=%s, SIG=%s, DIRECTIVE=%s",
- trp->name,
- SP(trp->file[file_dist].name),
- SP(trp->file[file_signature].name),
- SP(trp->file[file_directive].name));
+ wy_debug(1, ("FILE %s, DIST=%s, SIG=%s, DIRECTIVE=%s",
+ trp->name,
+ SP(trp->file[file_dist].name),
+ SP(trp->file[file_signature].name),
+ SP(trp->file[file_directive].name)));
switch (check_triplet_state(trp, 0)) {
case triplet_directive:
case triplet_complete:
- if (wy_debug_level)
- logmsg(LOG_DEBUG, _("processing triplet `%s'"),
- trp->name);
+ wy_debug(1, (_("processing triplet `%s'"), trp->name));
if (process_directives(trp))
remove_triplet(trp, 0);
return 0;
case triplet_incomplete:
- if (wy_debug_level)
- logmsg(LOG_DEBUG, _("%s: incomplete triplet"),
- trp->name);
+ wy_debug(1, (_("%s: incomplete triplet"), trp->name));
/* ignore unless expired (see below); */
UPDATE_STATS(STAT_INCOMPLETE_TRIPLETS);
break;
@@ -383,9 +374,8 @@ triplet_processor(void *data, void *proc_data)
void
spool_commit_triplets(struct spool *spool, struct file_triplet *tplist)
{
- if (wy_debug_level)
- logmsg(LOG_DEBUG, _("processing spool %s (%s)"),
- spool->tag, wy_url_printable(spool->dest_url));
+ wy_debug(1, (_("processing spool %s (%s)"),
+ spool->tag, wy_url_printable(spool->dest_url)));
if (spool_open_dictionaries(spool))
return;
if (tplist) {
@@ -419,12 +409,11 @@ triplet_linker(void *data, void *proc_data)
if (trp->job)
return 0;
- if (wy_debug_level)
- logmsg(LOG_DEBUG, "FILE %s, DIST=%s, SIG=%s, DIRECTIVE=%s",
- trp->name,
- SP(trp->file[file_dist].name),
- SP(trp->file[file_signature].name),
- SP(trp->file[file_directive].name));
+ wy_debug(1, ("FILE %s, DIST=%s, SIG=%s, DIRECTIVE=%s",
+ trp->name,
+ SP(trp->file[file_dist].name),
+ SP(trp->file[file_signature].name),
+ SP(trp->file[file_directive].name)));
switch (check_triplet_state(trp, 1)) {
case triplet_directive:
@@ -478,9 +467,8 @@ triplet_remove_file(struct spool *spool, const char *name)
}
if (!n) {
- if (wy_debug_level > 0)
- logmsg(LOG_DEBUG, "deleting empty triplet (%s/%s)",
- spool->source_dir, name);
+ wy_debug(1, ("deleting empty triplet (%s/%s)",
+ spool->source_dir, name));
remove_triplet(tp, 0);
}
}

Return to:

Send suggestions and report system problems to the System administrator.