r24780: More work allowing libutil to be used by external users.
[kai/samba.git] / source4 / lib / stream / packet.c
index 2c472641cc1406f4e0d5efd4d3afb1dca09f1495..e6cfae7bd69d0358fda46a4c94963255153f7718 100644 (file)
@@ -7,7 +7,7 @@
     
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -16,8 +16,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
 */
 
@@ -282,9 +281,8 @@ _PUBLIC_ void packet_recv(struct packet_context *pc)
 
        /* possibly expand the partial packet buffer */
        if (npending + pc->num_read > pc->partial.length) {
-               status = data_blob_realloc(pc, &pc->partial, npending+pc->num_read);
-               if (!NT_STATUS_IS_OK(status)) {
-                       packet_error(pc, status);
+               if (!data_blob_realloc(pc, &pc->partial, npending+pc->num_read)) {
+                       packet_error(pc, NT_STATUS_NO_MEMORY);
                        return;
                }
        }
@@ -323,9 +321,8 @@ _PUBLIC_ void packet_recv(struct packet_context *pc)
 
 next_partial:
        if (pc->partial.length != pc->num_read) {
-               status = data_blob_realloc(pc, &pc->partial, pc->num_read);
-               if (!NT_STATUS_IS_OK(status)) {
-                       packet_error(pc, status);
+               if (!data_blob_realloc(pc, &pc->partial, pc->num_read)) {
+                       packet_error(pc, NT_STATUS_NO_MEMORY);
                        return;
                }
        }
@@ -362,9 +359,8 @@ next_partial:
                        return;
                }
                /* Trunate the blob sent to the caller to only the packet length */
-               status = data_blob_realloc(pc, &blob, pc->packet_size);
-               if (!NT_STATUS_IS_OK(status)) {
-                       packet_error(pc, status);
+               if (!data_blob_realloc(pc, &blob, pc->packet_size)) {
+                       packet_error(pc, NT_STATUS_NO_MEMORY);
                        return;
                }
        } else {