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

package info (click to toggle)
cron 3.0pl1-162
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,204 kB
  • sloc: ansic: 47,007; perl: 733; makefile: 429; sh: 425; python: 36
file content (55 lines) | stat: -rw-r--r-- 1,483 bytes parent folder | download
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
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
Index: cron/cron.c
===================================================================
--- cron.orig/cron.c
+++ cron/cron.c
@@ -34,6 +34,7 @@ static char rcsid[] = "$Id: cron.c,v 2.1
 #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);
Index: cron/crontab.c
===================================================================
--- cron.orig/crontab.c
+++ cron/crontab.c
@@ -31,6 +31,7 @@ static char rcsid[] = "$Id: crontab.c,v
 #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, "");