File: crontab-wo-arguments-reads-from-stdin.patch

package info (click to toggle)
cron 3.0pl1-199
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,824 kB
  • sloc: ansic: 54,879; xml: 1,600; perl: 733; sh: 495; makefile: 446; python: 43
file content (32 lines) | stat: -rw-r--r-- 839 bytes parent folder | download | duplicates (3)
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
From: Christian Kastner <ckk@kvr.at>
Date: Fri, 15 Jan 2016 22:15:30 +0100
Subject: crontab without arguments reads from stdin

If crontab is run without argument, then POSIX mandates that it should read the
crontab from stdin. See

    http://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html

Fix provided by TANIGUCHI Takaki <takaki@asis.media-as.org>.

Bug-Debian: https://bugs.debian.org/514062
Forwarded: no
Last-Update: 2016-01-15
---
 crontab.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/crontab.c b/crontab.c
index 7060db3..76c83be 100644
--- a/crontab.c
+++ b/crontab.c
@@ -106,6 +106,9 @@ main(argc, argv)
 #if defined(BSD)
 	setlinebuf(stderr);
 #endif
+	if (argv[1] == NULL) {
+		argv[1] = "-";
+	}
 	parse_args(argc, argv);		/* sets many globals, opens a file */
 	set_cron_uid();
 	set_cron_cwd();