[Pkg-cron-devel] [pkg-cron] 17/19: Fix initialization and increment of mailed bytes counter
Christian Kastner
chrisk-guest at moszumanska.debian.org
Fri Oct 10 15:18:41 UTC 2014
This is an automated email from the git hooks/post-receive script.
chrisk-guest pushed a commit to branch ckk/cron-125
in repository pkg-cron.
commit 10693fc13a2fc0e52e4b15f0f26bcf6d0563173a
Author: Christian Kastner <debian at kvr.at>
Date: Thu Oct 9 22:59:49 2014 +0200
Fix initialization and increment of mailed bytes counter
The counter was being initialized to 1 instead of 0, and it wasn't being
incremented, therefore always returning 1.
Closes: #691488
---
do_command.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/do_command.c b/do_command.c
index 9f7240a..c22d9d6 100644
--- a/do_command.c
+++ b/do_command.c
@@ -542,7 +542,7 @@ child_process(e, u)
}
register FILE *mail = NULL;
- register int bytes = 1;
+ register int bytes = 0;
register char **env;
char **jobenv = build_env(e->envp);
@@ -616,6 +616,7 @@ child_process(e, u)
ret = fwrite(buf, 1, remain, mail);
if (ret > 0) {
remain -= ret;
+ bytes += ret;
continue;
}
// XXX error
@@ -633,9 +634,8 @@ child_process(e, u)
if (status) {
char buf[MAX_TEMPSTR];
snprintf(buf, MAX_TEMPSTR,
- "mailed %d byte%s of output; "
- "but got status 0x%04x, "
- "\n",
+ "mailed %d byte%s of output "
+ "but got status 0x%04x from MTA\n",
bytes, (bytes==1)?"":"s", status);
log_it(usernm, getpid(), "MAIL", buf);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-cron/pkg-cron.git
More information about the Pkg-cron-devel
mailing list