diff options
| author | rcritten <> | 2006-06-21 14:25:51 +0000 |
|---|---|---|
| committer | rcritten <> | 2006-06-21 14:25:51 +0000 |
| commit | 073a85756519c1d8ff59fb54261bbdbba3164b77 (patch) | |
| tree | adf375e0857c159d2fc37e034d2a3069edfa28ed | |
| parent | 330ebd5837eece4b0899fd2c9d0fa8b195a5b9d9 (diff) | |
196070
Fix some warnings related to not checking the return value of
getcwd and chdir.
| -rw-r--r-- | nss_engine_init.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/nss_engine_init.c b/nss_engine_init.c index 60cc250..ce2cfce 100644 --- a/nss_engine_init.c +++ b/nss_engine_init.c @@ -208,11 +208,23 @@ static void nss_init_SSLLibrary(server_rec *s, int sslenabled, int fipsenabled, /* We need to be in the same directory as libnssckbi.so to load the * root certificates properly. */ - getcwd(cwd, PATH_MAX); - chdir(mc->pCertificateDatabase); + if (getcwd(cwd, PATH_MAX) == NULL) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, + "Unable to determine current working directory"); + nss_die(); + } + if (chdir(mc->pCertificateDatabase) != 0) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, + "Unable to change directory to %s", mc->pCertificateDatabase); + nss_die(); + } /* Initialize NSS and open the certificate database read-only. */ rv = NSS_Initialize(mc->pCertificateDatabase, mc->pDBPrefix, mc->pDBPrefix, "secmod.db", NSS_INIT_READONLY); - chdir(cwd); + if (chdir(cwd) != 0) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, + "Unable to change directory to %s", cwd); + nss_die(); + } /* Assuming everything is ok so far, check the cert database password(s). */ if (sslenabled && (rv != SECSuccess)) { |
