|
@@ -59,14 +59,41 @@ set_workingdir()
|
|
|
errorlog = config_get_errorlog();
|
|
errorlog = config_get_errorlog();
|
|
|
if (NULL == errorlog) {
|
|
if (NULL == errorlog) {
|
|
|
rc = chdir("/");
|
|
rc = chdir("/");
|
|
|
|
|
+ if (0 == rc) {
|
|
|
|
|
+ if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, "/", errorbuf, 1) == LDAP_OPERATIONS_ERROR) {
|
|
|
|
|
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: set workingdir failed with \"%s\"\n", errorbuf);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: failed to chdir to %s\n", "/");
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
ptr = strrchr(errorlog, '/');
|
|
ptr = strrchr(errorlog, '/');
|
|
|
if (ptr) {
|
|
if (ptr) {
|
|
|
*ptr = '\0';
|
|
*ptr = '\0';
|
|
|
}
|
|
}
|
|
|
rc = chdir(errorlog);
|
|
rc = chdir(errorlog);
|
|
|
- if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, errorlog, errorbuf, 1) == LDAP_OPERATIONS_ERROR) {
|
|
|
|
|
- LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: set workingdir failed with \"%s\"\n", errorbuf);
|
|
|
|
|
|
|
+ if (0 == rc) {
|
|
|
|
|
+ if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, errorlog, errorbuf, 1) == LDAP_OPERATIONS_ERROR) {
|
|
|
|
|
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: set workingdir failed with \"%s\"\n", errorbuf);
|
|
|
|
|
+ rc = chdir("/");
|
|
|
|
|
+ if (0 == rc) {
|
|
|
|
|
+ if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, "/", errorbuf, 1) == LDAP_OPERATIONS_ERROR) {
|
|
|
|
|
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: set workingdir failed with \"%s\"\n", errorbuf);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: failed to chdir to %s\n", "/");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: failed to chdir to %s\n", errorlog);
|
|
|
|
|
+ rc = chdir("/");
|
|
|
|
|
+ if (0 == rc) {
|
|
|
|
|
+ if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, "/", errorbuf, 1) == LDAP_OPERATIONS_ERROR) {
|
|
|
|
|
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: set workingdir failed with \"%s\"\n", errorbuf);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: failed to chdir to %s\n", "/");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
slapi_ch_free_string(&errorlog);
|
|
slapi_ch_free_string(&errorlog);
|
|
|
}
|
|
}
|
|
@@ -75,8 +102,18 @@ set_workingdir()
|
|
|
if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, workingdir, errorbuf, 0) == LDAP_OPERATIONS_ERROR) {
|
|
if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, workingdir, errorbuf, 0) == LDAP_OPERATIONS_ERROR) {
|
|
|
LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: set workingdir failed with \"%s\"\n", errorbuf);
|
|
LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: set workingdir failed with \"%s\"\n", errorbuf);
|
|
|
rc = chdir("/");
|
|
rc = chdir("/");
|
|
|
|
|
+ if (0 == rc) {
|
|
|
|
|
+ if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, "/", errorbuf, 1) == LDAP_OPERATIONS_ERROR) {
|
|
|
|
|
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: set workingdir failed with \"%s\"\n", errorbuf);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: failed to chdir to %s\n", "/");
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
rc = chdir(workingdir);
|
|
rc = chdir(workingdir);
|
|
|
|
|
+ if (rc) {
|
|
|
|
|
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: failed to chdir to %s\n", workingdir);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
slapi_ch_free_string(&workingdir);
|
|
slapi_ch_free_string(&workingdir);
|
|
|
}
|
|
}
|
|
@@ -115,7 +152,7 @@ detach( int slapd_exemode, int importexport_encrypt,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (set_workingdir()) {
|
|
if (set_workingdir()) {
|
|
|
- LDAPDebug0Args(LDAP_DEBUG_ANY, "detach: chdir to workingdir failed.\n");
|
|
|
|
|
|
|
+ LDAPDebug0Args(LDAP_DEBUG_ANY, "detach: set_workingdir failed.\n");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if ( (sd = open( "/dev/null", O_RDWR )) == -1 ) {
|
|
if ( (sd = open( "/dev/null", O_RDWR )) == -1 ) {
|
|
@@ -142,7 +179,7 @@ detach( int slapd_exemode, int importexport_encrypt,
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
|
if (set_workingdir()) {
|
|
if (set_workingdir()) {
|
|
|
- LDAPDebug0Args(LDAP_DEBUG_ANY, "detach: chdir to workingdir failed.\n");
|
|
|
|
|
|
|
+ LDAPDebug0Args(LDAP_DEBUG_ANY, "detach: set_workingdir failed.\n");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|