aboutsummaryrefslogtreecommitdiff
path: root/miscutils/crontab.c
diff options
context:
space:
mode:
Diffstat (limited to 'miscutils/crontab.c')
-rw-r--r--miscutils/crontab.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/miscutils/crontab.c b/miscutils/crontab.c
index d442272f0..eb7c2059c 100644
--- a/miscutils/crontab.c
+++ b/miscutils/crontab.c
@@ -290,8 +290,7 @@ static void EditFile(const char *user, const char *file)
290 /* 290 /*
291 * CHILD - change user and run editor 291 * CHILD - change user and run editor
292 */ 292 */
293 char *ptr; 293 const char *ptr;
294 char visual[1024];
295 294
296 if (ChangeUser(user, 1) < 0) 295 if (ChangeUser(user, 1) < 0)
297 exit(0); 296 exit(0);
@@ -299,10 +298,9 @@ static void EditFile(const char *user, const char *file)
299 if (ptr == NULL || strlen(ptr) > 256) 298 if (ptr == NULL || strlen(ptr) > 256)
300 ptr = PATH_VI; 299 ptr = PATH_VI;
301 300
302 snprintf(visual, sizeof(visual), "%s %s", ptr, file); 301 ptr = xasprintf("%s %s", ptr, file);
303 execl(DEFAULT_SHELL, DEFAULT_SHELL, "-c", visual, NULL); 302 execl(DEFAULT_SHELL, DEFAULT_SHELL, "-c", ptr, NULL);
304 perror("exec"); 303 bb_perror_msg_and_die("exec");
305 exit(0);
306 } 304 }
307 if (pid < 0) { 305 if (pid < 0) {
308 /* 306 /*