diff options
Diffstat (limited to 'lib/getloadavg.c')
-rw-r--r-- | lib/getloadavg.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/getloadavg.c b/lib/getloadavg.c index dce4117f0..ed079b2ec 100644 --- a/lib/getloadavg.c +++ b/lib/getloadavg.c @@ -606,7 +606,9 @@ getloadavg (double loadavg[], int nelem) return -1; /* The following sscanf must use the C locale. */ - old_locale = xstrdup (setlocale (LC_NUMERIC, NULL)); + old_locale = setlocale (LC_NUMERIC, NULL); + if (old_locale) + old_locale = xstrdup (old_locale); setlocale (LC_NUMERIC, "C"); count = sscanf (ldavgbuf, "%lf %lf %lf", &load_ave[0], &load_ave[1], &load_ave[2]); |