use system() to spawn editor, so that it's possible to use EDITOR
setting which includes options; this reinstates functionality lost in rev 1.18
This commit is contained in:
parent
482ad5b141
commit
0d3df21f35
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: crontab.c,v 1.21 2003/12/07 16:50:43 is Exp $ */
|
||||
/* $NetBSD: crontab.c,v 1.22 2004/01/04 09:09:56 jdolecek Exp $ */
|
||||
|
||||
/* Copyright 1988,1990,1993,1994 by Paul Vixie
|
||||
* All rights reserved
|
||||
@ -22,7 +22,7 @@
|
||||
#if 0
|
||||
static char rcsid[] = "Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: crontab.c,v 1.21 2003/12/07 16:50:43 is Exp $");
|
||||
__RCSID("$NetBSD: crontab.c,v 1.22 2004/01/04 09:09:56 jdolecek Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -340,7 +340,7 @@ check_error(msg)
|
||||
static void
|
||||
edit_cmd() {
|
||||
char n[MAX_FNAME], q[MAX_TEMPSTR];
|
||||
char *editor;
|
||||
const char *editor;
|
||||
FILE *f;
|
||||
int ch, t;
|
||||
struct stat statbuf;
|
||||
@ -349,7 +349,7 @@ edit_cmd() {
|
||||
WAIT_T waiter;
|
||||
PID_T pid, xpid;
|
||||
sig_t oint, oabrt;
|
||||
char *argv[3];
|
||||
char *edit;
|
||||
|
||||
log_it(RealUser, Pid, "BEGIN EDIT", User);
|
||||
(void) snprintf(n, sizeof(n), CRON_TAB(User));
|
||||
@ -446,12 +446,12 @@ edit_cmd() {
|
||||
perror("chdir(/tmp)");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
argv[0] = editor;
|
||||
argv[1] = Filename;
|
||||
argv[2] = NULL;
|
||||
execvp(editor, argv);
|
||||
perror(editor);
|
||||
exit(ERROR_EXIT);
|
||||
asprintf(&edit, "%s %s", editor, Filename);
|
||||
if (system(edit) == -1) {
|
||||
perror(editor);
|
||||
exit(ERROR_EXIT);
|
||||
} else
|
||||
exit(OK_EXIT);
|
||||
/*NOTREACHED*/
|
||||
default:
|
||||
/* parent */
|
||||
@ -588,7 +588,7 @@ replace_cmd() {
|
||||
fprintf(tmp, "# DO NOT EDIT THIS FILE - edit the master and reinstall.\n");
|
||||
fprintf(tmp, "# (%s installed on %-24.24s)\n", Filename, ctime(&now));
|
||||
fprintf(tmp, "# (Cron version -- %s)\n",
|
||||
"$NetBSD: crontab.c,v 1.21 2003/12/07 16:50:43 is Exp $");
|
||||
"$NetBSD: crontab.c,v 1.22 2004/01/04 09:09:56 jdolecek Exp $");
|
||||
|
||||
/* copy the crontab to the tmp
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user