usbip: tools: change to use new error codes in server reply messages
[sfrench/cifs-2.6.git] / tools / usb / usbip / src / usbip_network.c
index 90325fa8bc3815e38f9aba416d92ae7797d213fe..8ffcd47d96385edc404dbfaca9fe50b11e6de1a3 100644 (file)
@@ -163,7 +163,7 @@ int usbip_net_send_op_common(int sockfd, uint32_t code, uint32_t status)
        return 0;
 }
 
-int usbip_net_recv_op_common(int sockfd, uint16_t *code)
+int usbip_net_recv_op_common(int sockfd, uint16_t *code, int *status)
 {
        struct op_common op_common;
        int rc;
@@ -191,10 +191,14 @@ int usbip_net_recv_op_common(int sockfd, uint16_t *code)
                if (op_common.code != *code) {
                        dbg("unexpected pdu %#0x for %#0x", op_common.code,
                            *code);
+                       /* return error status */
+                       *status = ST_ERROR;
                        goto err;
                }
        }
 
+       *status = op_common.status;
+
        if (op_common.status != ST_OK) {
                dbg("request failed at peer: %d", op_common.status);
                goto err;