diff options
| author | Rich Megginson <rmeggins@redhat.com> | 2010-08-13 14:32:22 -0600 |
|---|---|---|
| committer | Rich Megginson <rmeggins@redhat.com> | 2010-08-16 15:11:42 -0600 |
| commit | 9174cc61589ef4fc554ca82077bbddabc06e617b (patch) | |
| tree | 6a840f370d693f12e1858ac55f1560ee5c3009de /ldap | |
| parent | b44e8f4f2f5b399698e97e47e6fd211932e96719 (diff) | |
| download | ds-9174cc61589ef4fc554ca82077bbddabc06e617b.tar.gz ds-9174cc61589ef4fc554ca82077bbddabc06e617b.tar.xz ds-9174cc61589ef4fc554ca82077bbddabc06e617b.zip | |
Bug 610281 - fix coverity Defect Type: Control flow issues - daemon.c:write_function()
https://bugzilla.redhat.com/show_bug.cgi?id=610281
Resolves: bug 610281
Bug Description: fix coverity Defect Type: Control flow issues - daemon.c:write_function()
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: sentbytes < count is ok in the non error case - it just means
we need to send some more data. Move the checking to the error case so we
can print the number of bytes sent and expected.
Platforms tested: RHEL5 x86_64, Fedora 14 x86_64
Flag Day: no
Doc impact: no
Diffstat (limited to 'ldap')
| -rw-r--r-- | ldap/servers/slapd/daemon.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c index 783aaaed..249f247e 100644 --- a/ldap/servers/slapd/daemon.c +++ b/ldap/servers/slapd/daemon.c @@ -1712,6 +1712,11 @@ write_function( int ignore, const void *buffer, int count, struct lextiof_socket LDAPDebug(LDAP_DEBUG_ANY, "PR_Write(%d) " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n", fd, prerr, slapd_pr_strerror( prerr )); + if (sentbytes < count) { + LDAPDebug(LDAP_DEBUG_CONNS, + "PR_Write(%d) - wrote only %d bytes (expected %d bytes) - 0 (EOF)\n", /* disconnected */ + fd, sentbytes, count); + } break; /* fatal error */ } } else if (bytes == 0) { /* disconnect */ @@ -1731,12 +1736,6 @@ write_function( int ignore, const void *buffer, int count, struct lextiof_socket fd, sentbytes, count); PR_SetError(PR_BUFFER_OVERFLOW_ERROR, EMSGSIZE); break; - } else if (sentbytes < count) { - LDAPDebug(LDAP_DEBUG_CONNS, - "PR_Write(%d) - wrote only %d bytes (expected %d bytes) - 0 (EOF)\n", /* disconnected */ - fd, sentbytes, count); - PR_SetError(PR_PIPE_ERROR, EPIPE); - break; } } } |
