diff options
author | Denis Vlasenko | 2007-01-29 22:51:44 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-01-29 22:51:44 +0000 |
commit | 06c0a71d2315756db874e98bc4f760ca3283b6a6 (patch) | |
tree | df385c84041f3fd8328e7a50caef4495ef2734a8 /miscutils/crontab.c | |
parent | b6aae0f38194cd39960a898606ee65d4be93a895 (diff) | |
download | busybox-06c0a71d2315756db874e98bc4f760ca3283b6a6.zip busybox-06c0a71d2315756db874e98bc4f760ca3283b6a6.tar.gz |
preparatory patch for -Wwrite-strings #3
Diffstat (limited to 'miscutils/crontab.c')
-rw-r--r-- | miscutils/crontab.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/miscutils/crontab.c b/miscutils/crontab.c index d442272..eb7c205 100644 --- a/miscutils/crontab.c +++ b/miscutils/crontab.c @@ -290,8 +290,7 @@ static void EditFile(const char *user, const char *file) /* * CHILD - change user and run editor */ - char *ptr; - char visual[1024]; + const char *ptr; if (ChangeUser(user, 1) < 0) exit(0); @@ -299,10 +298,9 @@ static void EditFile(const char *user, const char *file) if (ptr == NULL || strlen(ptr) > 256) ptr = PATH_VI; - snprintf(visual, sizeof(visual), "%s %s", ptr, file); - execl(DEFAULT_SHELL, DEFAULT_SHELL, "-c", visual, NULL); - perror("exec"); - exit(0); + ptr = xasprintf("%s %s", ptr, file); + execl(DEFAULT_SHELL, DEFAULT_SHELL, "-c", ptr, NULL); + bb_perror_msg_and_die("exec"); } if (pid < 0) { /* |