[Commits] 732d45e: MDEV-8378 - Debian: the Lintian complains about many "shlib-calls-exit" in many

Sergey Vojtovich svoj at mariadb.org
Mon Dec 14 13:29:31 EET 2015


revision-id: 732d45e93b81a104e3f3931e4908e22167a54622 (mariadb-10.0.22-57-g732d45e)
parent(s): 3e206a518dec400e084451165f633b78eb2e7fee
committer: Sergey Vojtovich
timestamp: 2015-12-14 15:27:09 +0400
message:

MDEV-8378 - Debian: the Lintian complains about many "shlib-calls-exit" in many
            of the plugins

Fixed exit/_exit calls from libdaemon_example.so, libmysqlclient.so,
libmysqlclient_r.so, libmysqld.so.

Note: this is just rough prototype, not to be pushed. libmysqld.so still has
a bunch of exit/_exit calls from InnoDB.

---
 mysys/my_addr_resolve.c                 |  2 +-
 mysys/my_default.c                      |  4 ++--
 mysys/my_malloc.c                       |  2 +-
 mysys/my_static.c                       |  3 ++-
 mysys/typelib.c                         |  2 +-
 plugin/daemon_example/daemon_example.cc |  2 +-
 sql-common/client.c                     |  2 +-
 sql/signal_handler.cc                   |  4 ++--
 sql/sql_connect.cc                      | 10 +++++-----
 sql/sys_vars.h                          |  2 +-
 strings/str_alloc.c                     |  2 +-
 11 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c
index 90e6f43..276d5aa 100644
--- a/mysys/my_addr_resolve.c
+++ b/mysys/my_addr_resolve.c
@@ -190,7 +190,7 @@ const char *my_addr_resolve_init()
       close(out[0]);
       close(out[1]);
       execlp("addr2line", "addr2line", "-C", "-f", "-e", my_progname, NULL);
-      exit(1);
+      abort();
     }
     
     close(in[0]);
diff --git a/mysys/my_default.c b/mysys/my_default.c
index 8faee00..7bf86f2 100644
--- a/mysys/my_default.c
+++ b/mysys/my_default.c
@@ -631,7 +631,7 @@ int my_load_defaults(const char *conf_file, const char **groups,
       if (!my_getopt_is_args_separator((*argv)[i])) /* skip arguments separator */
         printf("%s ", (*argv)[i]);
     puts("");
-    exit(0);
+    abort(); /* !!! */
   }
 
   if (default_directories)
@@ -641,7 +641,7 @@ int my_load_defaults(const char *conf_file, const char **groups,
 
  err:
   fprintf(stderr,"Fatal error in defaults handling. Program aborted\n");
-  exit(1);
+  abort();
   return 0;					/* Keep compiler happy */
 }
 
diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c
index e5332301..111bc7f 100644
--- a/mysys/my_malloc.c
+++ b/mysys/my_malloc.c
@@ -108,7 +108,7 @@ void *my_malloc(size_t size, myf my_flags)
       my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_WAITTANG +
                                    ME_NOREFRESH + ME_FATALERROR),size);
     if (my_flags & MY_FAE)
-      exit(1);
+      abort();
   }
   else
   {
diff --git a/mysys/my_static.c b/mysys/my_static.c
index 84d2dc6..4272c24 100644
--- a/mysys/my_static.c
+++ b/mysys/my_static.c
@@ -72,7 +72,8 @@ ulong my_time_to_wait_for_lock=2;	/* In seconds */
 #ifdef SHARED_LIBRARY
 const char *globerrs[GLOBERRS];		/* my_error_messages is here */
 #endif
-void (*my_abort_hook)(int) = (void(*)(int)) exit;
+void my_abort_wrapper(int a __attribute__((unused))) { abort(); }
+void (*my_abort_hook)(int)= my_abort_wrapper;
 void (*error_handler_hook)(uint error, const char *str, myf MyFlags)=
   my_message_stderr;
 void (*fatal_error_handler_hook)(uint error, const char *str, myf MyFlags)=
diff --git a/mysys/typelib.c b/mysys/typelib.c
index 75744a6..ec1e8fb 100644
--- a/mysys/typelib.c
+++ b/mysys/typelib.c
@@ -51,7 +51,7 @@ int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option)
   if ((res= find_type_with_warning(x, typelib, option)) <= 0)
   {
     sf_leaking_memory= 1; /* no memory leak reports here */
-    exit(1);
+    abort();
   }
   return res;
 }
diff --git a/plugin/daemon_example/daemon_example.cc b/plugin/daemon_example/daemon_example.cc
index dbc3c5c..cdea632 100644
--- a/plugin/daemon_example/daemon_example.cc
+++ b/plugin/daemon_example/daemon_example.cc
@@ -129,7 +129,7 @@ static int daemon_example_plugin_init(void *p __attribute__ ((unused)))
                      (void *)con) != 0)
   {
     fprintf(stderr,"Could not create heartbeat thread!\n");
-    exit(0);
+    DBUG_RETURN(1);
   }
   plugin->data= (void *)con;
 
diff --git a/sql-common/client.c b/sql-common/client.c
index d20759c..7a4efc3 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1219,7 +1219,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
                                             FIND_TYPE_BASIC)) <= 0)
           {
             fprintf(stderr, "Unknown option to protocol: %s\n", opt_arg);
-            exit(1);
+            abort();
           }
           break;
         case OPT_shared_memory_base_name:
diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc
index 3fadbcd..b301b4c 100644
--- a/sql/signal_handler.cc
+++ b/sql/signal_handler.cc
@@ -69,7 +69,7 @@ extern "C" sig_handler handle_fatal_signal(int sig)
   if (segfaulted)
   {
     my_safe_printf_stderr("Fatal " SIGNAL_FMT " while backtracing\n", sig);
-    _exit(1); /* Quit without running destructors */
+    abort();
   }
 
   segfaulted = 1;
@@ -269,7 +269,7 @@ extern "C" sig_handler handle_fatal_signal(int sig)
      Quit, without running destructors (etc.)
      On Windows, do not terminate, but pass control to exception filter.
   */
-  _exit(1);  // Using _exit(), since exit() is not async signal safe
+  abort();
 #else
   return;
 #endif
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 4d2c48c..d69750f 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -319,7 +319,7 @@ void init_max_user_conn(void)
                  (my_hash_free_key) free_user, 0))
   {
     sql_print_error("Initializing hash_user_connections failed.");
-    exit(1);
+    abort();
   }
 #endif
 }
@@ -530,7 +530,7 @@ void init_global_user_stats(void)
                 (my_hash_free_key)free_user_stats, 0))
   {
     sql_print_error("Initializing global_user_stats failed.");
-    exit(1);
+    abort();
   }
 }
 
@@ -541,7 +541,7 @@ void init_global_client_stats(void)
                 (my_hash_free_key)free_user_stats, 0))
   {
     sql_print_error("Initializing global_client_stats failed.");
-    exit(1);
+    abort();
   }
 }
 
@@ -563,7 +563,7 @@ void init_global_table_stats(void)
                 0, 0, (my_hash_get_key) get_key_table_stats,
                 (my_hash_free_key)free_table_stats, 0)) {
     sql_print_error("Initializing global_table_stats failed.");
-    exit(1);
+    abort();
   }
 }
 
@@ -586,7 +586,7 @@ void init_global_index_stats(void)
                 (my_hash_free_key)free_index_stats, 0))
   {
     sql_print_error("Initializing global_index_stats failed.");
-    exit(1);
+    abort();
   }
 }
 
diff --git a/sql/sys_vars.h b/sql/sys_vars.h
index 36067c5..fc9f210 100644
--- a/sql/sys_vars.h
+++ b/sql/sys_vars.h
@@ -86,7 +86,7 @@
     {                                                                   \
       fprintf(stderr, "Sysvar '%s' failed '%s'\n", name_arg, #X);           \
       DBUG_ABORT();                                                    \
-      exit(255);                                                        \
+      abort();                                                         \
     }
 
 enum charset_enum {IN_SYSTEM_CHARSET, IN_FS_CHARSET};
diff --git a/strings/str_alloc.c b/strings/str_alloc.c
index 9124660..8ae386d 100644
--- a/strings/str_alloc.c
+++ b/strings/str_alloc.c
@@ -22,7 +22,7 @@ static void *my_str_malloc_default(size_t size)
 {
   void *ret= malloc(size);
   if (!ret)
-    exit(1);
+    abort();
   return ret;
 }
 


More information about the commits mailing list