File: Tolerate-empty-EDITOR-and-VISUAL-envvars.patch

package info (click to toggle)
cron 3.0pl1-194
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 3,812 kB
  • sloc: ansic: 54,879; xml: 1,499; perl: 733; sh: 463; makefile: 446; python: 43
file content (30 lines) | stat: -rw-r--r-- 798 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
From: Christian Kastner <ckk@kvr.at>
Date: Tue, 22 Dec 2015 23:08:18 +0100
Subject: Tolerate empty EDITOR and VISUAL envvars

Treat empty EDITOR and VISUAL environment variables as if they were unset.

Fix provided by Steve Greenland <stevegr@debian.org>.

Bug-Debian: https://bugs.debian.org/148809
Forwarded: no
Last-Update: 2015-12-22
---
 crontab.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/crontab.c b/crontab.c
index a43d9ce..c71bc38 100644
--- a/crontab.c
+++ b/crontab.c
@@ -394,8 +394,8 @@ edit_cmd() {
 	}
 	mtime = statbuf.st_mtime;
 
-	if ((!(editor = getenv("VISUAL")))
-	 && (!(editor = getenv("EDITOR")))
+	if ((!((editor = getenv("VISUAL")) && strlen(editor)))
+	 && (!((editor = getenv("EDITOR")) && strlen(editor)))
 	    ) {
 		editor = EDITOR;
 	}