diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-01 06:01:50 +0000 |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-01 06:01:50 +0000 |
commit | 0b9ca89dbb0329b07a844f5b4de46e50171705d1 (patch) | |
tree | 3c9482e3254071b7094f6de2a0939b8b05e75719 | |
parent | 30c81e1c780ea80d316ee5f705b124abe4ab12bd (diff) | |
download | monitoring-plugins-0b9ca89dbb0329b07a844f5b4de46e50171705d1.tar.gz |
set LC_ALL to C in execve environemnt
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@625 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r-- | plugins/popen.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/popen.c b/plugins/popen.c index d4151e61..e41ae9ae 100644 --- a/plugins/popen.c +++ b/plugins/popen.c | |||
@@ -67,7 +67,7 @@ static int maxfd; /* from our open_max(), {Prog openmax} */ | |||
67 | FILE * | 67 | FILE * |
68 | spopen (const char *cmdstring) | 68 | spopen (const char *cmdstring) |
69 | { | 69 | { |
70 | char *environ[] = { NULL }; | 70 | char *env[] = { "LC_ALL=C", (char*)0 }; |
71 | char *cmd = NULL; | 71 | char *cmd = NULL; |
72 | char **argv = NULL; | 72 | char **argv = NULL; |
73 | char *str; | 73 | char *str; |
@@ -182,7 +182,7 @@ spopen (const char *cmdstring) | |||
182 | if (childpid[i] > 0) | 182 | if (childpid[i] > 0) |
183 | close (i); | 183 | close (i); |
184 | 184 | ||
185 | execve (argv[0], argv, environ); | 185 | execve (argv[0], argv, env); |
186 | _exit (0); | 186 | _exit (0); |
187 | } | 187 | } |
188 | 188 | ||
@@ -199,7 +199,7 @@ spopen (const char *cmdstring) | |||
199 | int | 199 | int |
200 | spclose (FILE * fp) | 200 | spclose (FILE * fp) |
201 | { | 201 | { |
202 | int fd, stat; | 202 | int fd, status; |
203 | pid_t pid; | 203 | pid_t pid; |
204 | 204 | ||
205 | if (childpid == NULL) | 205 | if (childpid == NULL) |
@@ -213,12 +213,12 @@ spclose (FILE * fp) | |||
213 | if (fclose (fp) == EOF) | 213 | if (fclose (fp) == EOF) |
214 | return (1); | 214 | return (1); |
215 | 215 | ||
216 | while (waitpid (pid, &stat, 0) < 0) | 216 | while (waitpid (pid, &status, 0) < 0) |
217 | if (errno != EINTR) | 217 | if (errno != EINTR) |
218 | return (1); /* error other than EINTR from waitpid() */ | 218 | return (1); /* error other than EINTR from waitpid() */ |
219 | 219 | ||
220 | if (WIFEXITED (stat)) | 220 | if (WIFEXITED (status)) |
221 | return (WEXITSTATUS (stat)); /* return child's termination status */ | 221 | return (WEXITSTATUS (status)); /* return child's termination status */ |
222 | 222 | ||
223 | return (1); | 223 | return (1); |
224 | } | 224 | } |