From 0be67c5400586fe8a445fd12e7c56c23aa52e9dc Mon Sep 17 00:00:00 2001 From: Tim Landscheidt Date: Wed, 6 Jun 2012 15:57:48 +0200 Subject: [PATCH] Fix use of "const char *" in call to putenv(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcela Mašláňová --- anacron/runjob.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/anacron/runjob.c b/anacron/runjob.c index ba4dc06..32c7100 100644 --- a/anacron/runjob.c +++ b/anacron/runjob.c @@ -97,7 +97,9 @@ username() static void xputenv(const char *s) { - if (putenv(s)) die_e("Can't set the environment"); + char *copy = strdup (s); + if (!copy) die_e("Not enough memory to set the environment"); + if (putenv(copy)) die_e("Can't set the environment"); } static void -- 2.40.0