File: Use-basename-for-syslog-tag.patch

package info (click to toggle)
cron 3.0pl1-198
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,824 kB
  • sloc: ansic: 54,879; xml: 1,600; perl: 733; sh: 495; makefile: 446; python: 43
file content (60 lines) | stat: -rw-r--r-- 1,575 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
From: Christian Kastner <ckk@kvr.at>
Date: Sat, 26 Dec 2015 19:40:39 +0100
Subject: Use basename for syslog tag

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 package logcheck-database do not have to be updated; they
already considered the dirname of argv[0] to be an optional prefix.

Bug-Debian: https://bugs.debian.org/752750
Forwarded: no
Last-Update: 2015-12-26
---
 cron.c    | 3 ++-
 crontab.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/cron.c b/cron.c
index 490ea9e..3659a1f 100644
--- a/cron.c
+++ b/cron.c
@@ -34,6 +34,7 @@ static char rcsid[] = "$Id: cron.c,v 2.11 1994/01/15 20:43:43 vixie Exp $";
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <fcntl.h>
+#include <libgen.h>
 
 static	void	usage __P((void)),
 		run_reboot_jobs __P((cron_db *)),
@@ -61,7 +62,7 @@ main(argc, argv)
 {
 	cron_db	database;
 
-	ProgramName = argv[0];
+	ProgramName = basename(argv[0]);
 
 #if defined(BSD)
 	setlinebuf(stdout);
diff --git a/crontab.c b/crontab.c
index fae9fc2..d31abe8 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>
@@ -96,7 +97,7 @@ main(argc, argv)
 	int	exitstatus;
 
 	Pid = getpid();
-	ProgramName = argv[0];
+	ProgramName = basename(argv[0]);
 
 #if defined(POSIX)
 	setlocale(LC_ALL, "");