summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Kinder <nkinder@redhat.com>2010-09-09 14:58:55 -0700
committerNathan Kinder <nkinder@redhat.com>2010-09-09 14:58:55 -0700
commit245d17832879a160eb85a7a9d784aa2ac4f2081d (patch)
treeb0cc71515efe85f5b64ebb8bcc80951f92b80221
parent660629d99dd270dc26472c10d3e9f7e2dea899b5 (diff)
downloadds-245d17832879a160eb85a7a9d784aa2ac4f2081d.tar.gz
ds-245d17832879a160eb85a7a9d784aa2ac4f2081d.tar.xz
ds-245d17832879a160eb85a7a9d784aa2ac4f2081d.zip
Bug 630094 - (cov#15581) Add missing breaks in agt_mopen_stats()
The switch statements in agt_mopen_stats() are missing breaks to prevent falling through to the next case when the stats file is opened in read-only mode. This looks like it causes the stats file to get opened a second time in read/write mode when ldap-agent attempts to open it in read-only mode. This may leak file descriptors in ldap-agent. We need to add the proper break statements.
-rw-r--r--ldap/servers/slapd/agtmmap.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ldap/servers/slapd/agtmmap.c b/ldap/servers/slapd/agtmmap.c
index 82862513..d82da5fd 100644
--- a/ldap/servers/slapd/agtmmap.c
+++ b/ldap/servers/slapd/agtmmap.c
@@ -178,6 +178,7 @@ agt_mopen_stats (char * statsfile, int mode, int *hdl)
fprintf (stderr, "%s@%d> opened fp = %d\n", __FILE__, __LINE__, fp);
#endif
rc = 0;
+ break;
case O_RDWR:
fd = open (path,
@@ -225,7 +226,7 @@ agt_mopen_stats (char * statsfile, int mode, int *hdl)
*hdl = 1;
rc = 0;
-
+ break;
} /* end switch */
#else
/* _WIN32 */
@@ -273,6 +274,7 @@ agt_mopen_stats (char * statsfile, int mode, int *hdl)
*hdl = 0;
rc = 0;
+ break;
}
case O_RDWR:
@@ -317,6 +319,7 @@ agt_mopen_stats (char * statsfile, int mode, int *hdl)
*hdl = 1;
rc = 0;
+ break;
}