1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
Description: Fix GnuTLS backend by postponing initialization after it daemonized.
Backport upstream commits from version 15.2.
Origin: https://github.com/bareos/bareos/commit/9097aaeaefe904b40af602caddf5d9cd59959625
https://github.com/bareos/bareos/commit/ecb539bc44c0224b378e6e9626b86ea718da5c2c
--- bareos-14.2.6.orig/src/dird/dird.c
+++ bareos-14.2.6/src/dird/dird.c
@@ -285,6 +285,13 @@ int main (int argc, char *argv[])
my_config = new_config_parser();
parse_dir_config(my_config, configfile, M_ERROR_TERM);
+ if (!test_config) { /* we don't need to do this block in test mode */
+ if (background) {
+ daemon_start();
+ init_stack_dump(); /* grab new pid */
+ }
+ }
+
if (init_crypto() != 0) {
Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Cryptography library initialization failed.\n"));
goto bail_out;
@@ -296,10 +303,6 @@ int main (int argc, char *argv[])
}
if (!test_config) { /* we don't need to do this block in test mode */
- if (background) {
- daemon_start();
- init_stack_dump(); /* grab new pid */
- }
/* Create pid must come after we are a daemon -- so we have our final pid */
create_pid_file(me->pid_directory, "bareos-dir",
get_first_port_host_order(me->DIRaddrs));
--- bareos-14.2.6.orig/src/filed/filed.c
+++ bareos-14.2.6/src/filed/filed.c
@@ -213,6 +213,11 @@ int main (int argc, char *argv[])
my_config = new_config_parser();
parse_fd_config(my_config, configfile, M_ERROR_TERM);
+ if (!foreground && !test_config) {
+ daemon_start();
+ init_stack_dump(); /* set new pid */
+ }
+
if (init_crypto() != 0) {
Emsg0(M_ERROR, 0, _("Cryptography library initialization failed.\n"));
terminate_filed(1);
@@ -237,11 +242,6 @@ int main (int argc, char *argv[])
terminate_filed(0);
}
- if (!foreground) {
- daemon_start();
- init_stack_dump(); /* set new pid */
- }
-
set_thread_concurrency(me->MaxConcurrentJobs + 10);
lmgr_init_thread(); /* initialize the lockmanager stack */
--- bareos-14.2.6.orig/src/stored/stored.c
+++ bareos-14.2.6/src/stored/stored.c
@@ -219,6 +219,11 @@ int main (int argc, char *argv[])
my_config = new_config_parser();
parse_sd_config(my_config, configfile, M_ERROR_TERM);
+ if (!foreground && !test_config) {
+ daemon_start(); /* become daemon */
+ init_stack_dump(); /* pick up new pid */
+ }
+
if (init_crypto() != 0) {
Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Cryptography library initialization failed.\n"));
}
@@ -235,11 +240,6 @@ int main (int argc, char *argv[])
my_name_is(0, (char **)NULL, me->hdr.name); /* Set our real name */
- if (!foreground) {
- daemon_start(); /* become daemon */
- init_stack_dump(); /* pick up new pid */
- }
-
create_pid_file(me->pid_directory, "bareos-sd",
get_first_port_host_order(me->SDaddrs));
read_state_file(me->working_directory, "bareos-sd",
|