diff options
author | joerg <joerg@FreeBSD.org> | 1995-09-10 13:02:56 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1995-09-10 13:02:56 +0000 |
commit | b4e6cbbd8a75089b1a9fae4421063c8dc3278624 (patch) | |
tree | aff3c9c72114d926b601ff88bd8c59bcdf7ccac0 /usr.sbin/cron | |
parent | 167f3fbb0412d6adb73a5941db3245b893b987dd (diff) | |
download | FreeBSD-src-b4e6cbbd8a75089b1a9fae4421063c8dc3278624.zip FreeBSD-src-b4e6cbbd8a75089b1a9fae4421063c8dc3278624.tar.gz |
Fix a bug that prevented %'s and \'s from being passed to the program
invoked.
Submitted by: fenner@parc.xerox.com (Bill Fenner)
Diffstat (limited to 'usr.sbin/cron')
-rw-r--r-- | usr.sbin/cron/cron/do_command.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/usr.sbin/cron/cron/do_command.c b/usr.sbin/cron/cron/do_command.c index f924d34..51e6fee 100644 --- a/usr.sbin/cron/cron/do_command.c +++ b/usr.sbin/cron/cron/do_command.c @@ -16,7 +16,7 @@ */ #if !defined(lint) && !defined(LINT) -static char rcsid[] = "$Id: do_command.c,v 1.4 1995/04/14 21:54:18 ache Exp $"; +static char rcsid[] = "$Id: do_command.c,v 1.5 1995/05/30 03:47:00 rgrimes Exp $"; #endif @@ -122,13 +122,21 @@ child_process(e, u) * command, and subsequent characters are the additional input to * the command. Subsequent %'s will be transformed into newlines, * but that happens later. + * + * If there are escaped %'s, remove the escape character. */ /*local*/{ register int escaped = FALSE; register int ch; + register char *p; - for (input_data = e->cmd; ch = *input_data; input_data++) { + for (input_data = p = e->cmd; ch = *input_data; + input_data++, p++) { + if (p != input_data) + *p = ch; if (escaped) { + if (ch == '%' || ch == '\\') + *--p = ch; escaped = FALSE; continue; } @@ -141,6 +149,7 @@ child_process(e, u) break; } } + *p = '\0'; } /* fork again, this time so we can exec the user's command. |