Author: rcritten
Update of /cvs/dirsec/mod_nss
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv17633
Modified Files:
nss_engine_init.c
Log Message:
196070
Fix some warnings related to not checking the return value of
getcwd and chdir.
Index: nss_engine_init.c
===================================================================
RCS file: /cvs/dirsec/mod_nss/nss_engine_init.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- nss_engine_init.c 20 Jun 2006 20:25:20 -0000 1.19
+++ nss_engine_init.c 21 Jun 2006 14:25:51 -0000 1.20
@@ -208,11 +208,23 @@
/* 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)) {
Show replies by date