From: Volker Lendecke Date: Mon, 5 Mar 2012 14:40:49 +0000 (+0100) Subject: s3: Move the drain_socket on error to reply_write_and_X X-Git-Tag: tdb-1.2.10~358 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=216769f2ce7d18a7ca83bf440b6efd7ad4675675;p=thirdparty%2Fsamba.git s3: Move the drain_socket on error to reply_write_and_X That's the only case where this can happen, so we should not clutter the main code path. --- diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 15e1efe4a0a..f61ad5d2474 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -1521,15 +1521,6 @@ static void construct_reply(struct smbd_server_connection *sconn, conn = switch_message(req->cmd, req); - if (req->unread_bytes) { - /* writeX failed. drain socket. */ - if (drain_socket(req->sconn->sock, req->unread_bytes) != - req->unread_bytes) { - smb_panic("failed to drain pending bytes"); - } - req->unread_bytes = 0; - } - if (req->done) { TALLOC_FREE(req); return; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 6e6e73f5846..e3a3766239a 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -4647,6 +4647,15 @@ void reply_write_and_X(struct smb_request *req) return; out: + if (req->unread_bytes) { + /* writeX failed. drain socket. */ + if (drain_socket(req->sconn->sock, req->unread_bytes) != + req->unread_bytes) { + smb_panic("failed to drain pending bytes"); + } + req->unread_bytes = 0; + } + END_PROFILE(SMBwriteX); return; }