Fix bug in `expr_clone`
[platform/upstream/ltrace.git] / libltrace.c
index d43a9b2..0112c9f 100644 (file)
 
 #include "config.h"
 
-#include <limits.h>
 #include <sys/param.h>
 #include <sys/wait.h>
 #include <errno.h>
+#include <limits.h>
+#include <locale.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
+#include "backend.h"
 #include "common.h"
 #include "proc.h"
-#include "read_config_file.h"
-#include "backend.h"
 #include "prototype.h"
+#include "read_config_file.h"
+#include "summary.h"
 
 char *command = NULL;
 
@@ -99,7 +101,10 @@ normal_exit(void)
 }
 
 void
-ltrace_init(int argc, char **argv) {
+ltrace_init(int argc, char **argv)
+{
+       setlocale(LC_ALL, "");
+
        struct opt_p_t *opt_p_tmp;
 
        atexit(normal_exit);
@@ -112,9 +117,13 @@ ltrace_init(int argc, char **argv) {
        if (command) {
                /* Check that the binary ABI is supported before
                 * calling execute_program.  */
-               struct ltelf lte;
-               ltelf_init(&lte, command);
-               ltelf_destroy(&lte);
+               {
+                       struct ltelf lte;
+                       if (ltelf_init(&lte, command) == 0)
+                               ltelf_destroy(&lte);
+                       else
+                               exit(EXIT_FAILURE);
+               }
 
                pid_t pid = execute_program(command, argv);
                struct process *proc = open_program(command, pid);