From 245d17832879a160eb85a7a9d784aa2ac4f2081d Mon Sep 17 00:00:00 2001 From: Nathan Kinder Date: Thu, 9 Sep 2010 14:58:55 -0700 Subject: 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. --- ldap/servers/slapd/agtmmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ldap') 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; } -- cgit