[Pkg-cron-devel] [pkg-cron] 13/19: Use basename of argv[0] as syslog tag

Christian Kastner chrisk-guest at moszumanska.debian.org
Fri Oct 10 15:18:40 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 996587cec44834a4ea4dd2f7659a9cd50f6d3896
Author: Christian Kastner <debian at kvr.at>
Date:   Thu Oct 9 13:40:47 2014 +0200

    Use basename of argv[0] as syslog tag
    
    This avoids the inclusion of the "/" character, which is a violation of RFC
    3164.
    
    The rule files of logcheck-database do not have to be updated; they already
    considered the dirname of argv[0] to be an optional prefix.
    
    Closes: #752750
---
 cron.c    | 3 ++-
 crontab.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/cron.c b/cron.c
index 5630b4d..977d2f8 100644
--- a/cron.c
+++ b/cron.c
@@ -28,6 +28,7 @@ static char rcsid[] = "$Id: cron.c,v 2.11 1994/01/15 20:43:43 vixie Exp $";
 
 #include <sys/types.h>
 #include <fcntl.h>
+#include <libgen.h>
 
 static	void	usage __P((void)),
 		run_reboot_jobs __P((cron_db *)),
@@ -65,7 +66,7 @@ main(argc, argv)
 	cron_db	database;
 	char *cs;
 
-	ProgramName = argv[0];
+	ProgramName = basename(argv[0]);
 
 #if defined(BSD)
 	setlinebuf(stdout);
diff --git a/crontab.c b/crontab.c
index 149350e..029e0a0 100644
--- a/crontab.c
+++ b/crontab.c
@@ -31,6 +31,7 @@ static char rcsid[] = "$Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $";
 #include "cron.h"
 #include <errno.h>
 #include <fcntl.h>
+#include <libgen.h>
 #include <signal.h>
 #include <sys/file.h>
 #include <sys/stat.h>
@@ -100,7 +101,7 @@ main(argc, argv)
 	int	exitstatus;
 
 	Pid = getpid();
-	ProgramName = argv[0];
+	ProgramName = basename(argv[0]);
 
 #if defined(POSIX)
 	setlocale(LC_ALL, "");

-- 
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