--- libaitrpc/src/blob.c 2011/08/19 12:51:50 1.2.4.2 +++ libaitrpc/src/blob.c 2011/08/19 13:40:20 1.2.4.4 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: blob.c,v 1.2.4.2 2011/08/19 12:51:50 misho Exp $ +* $Id: blob.c,v 1.2.4.4 2011/08/19 13:40:20 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -188,7 +188,7 @@ rpc_srv_blobFree(rpc_srv_t * __restrict srv, rpc_blob_ memset(szFName, 0, MAXPATHLEN); snprintf(szFName, MAXPATHLEN, BLOB_FILE, srv->srv_blob.dir, blob->blob_var); - if (remove(szFName) == -1) { + if (unlink(szFName) == -1) { LOGERR; return -1; } @@ -216,7 +216,7 @@ rpc_srv_sendBLOB(rpc_cli_t * __restrict cli, rpc_blob_ } for (ret = blob->blob_len, pos = blob->blob_data; ret > 0; ret -= len, pos += len) { - len = send(cli->cli_sock, pos, ret > BLOBSIZ ? BLOBSIZ : ret, 0); + len = send(cli->cli_sock, pos, ret, 0); if (len == -1) { LOGERR; return -1; @@ -254,7 +254,7 @@ rpc_srv_recvBLOB(rpc_cli_t * __restrict cli, rpc_blob_ return -1; } - len = recv(cli->cli_sock, pos, BLOBSIZ, 0); + len = recv(cli->cli_sock, pos, ret, 0); if (len == -1) { LOGERR; return -1; @@ -292,13 +292,13 @@ rpc_cli_sendBLOB(rpc_cli_t * __restrict cli, rpc_val_t hdr.hdr_var = 0; hdr.hdr_ret = 0; hdr.hdr_len = var->val_len; - if (write(cli->cli_sock, &hdr, sizeof hdr) == -1) { + if (send(cli->cli_sock, &hdr, sizeof hdr, 0) == -1) { LOGERR; return -1; } for (ret = var->val_len, pos = data; ret > 0; ret -= len, pos += len) - if ((len = write(cli->cli_sock, pos, ret > BLOBSIZ ? BLOBSIZ : ret)) == -1) { + if ((len = send(cli->cli_sock, pos, ret, 0)) == -1) { LOGERR; return -1; } @@ -313,7 +313,7 @@ rpc_cli_sendBLOB(rpc_cli_t * __restrict cli, rpc_val_t rpc_SetErr(ETIMEDOUT, "Error:: Timeout reached! Server not responde ...\n"); return -1; } - if (read(cli->cli_sock, &hdr, sizeof hdr) == -1) { + if (recv(cli->cli_sock, &hdr, sizeof hdr, 0) == -1) { LOGERR; return -1; } @@ -362,7 +362,7 @@ rpc_cli_recvBLOB(rpc_cli_t * __restrict cli, rpc_val_t hdr.hdr_var = (uint32_t) RPC_GET_BLOB(var); hdr.hdr_ret = 0; hdr.hdr_len = 0; - if (write(cli->cli_sock, &hdr, sizeof hdr) == -1) { + if (send(cli->cli_sock, &hdr, sizeof hdr, 0) == -1) { LOGERR; free(*data); *data = NULL; @@ -380,7 +380,7 @@ rpc_cli_recvBLOB(rpc_cli_t * __restrict cli, rpc_val_t return -1; } - if ((len = read(cli->cli_sock, pos, BLOBSIZ)) == -1) { + if ((len = recv(cli->cli_sock, pos, ret, 0)) == -1) { LOGERR; free(*data); *data = NULL; @@ -402,7 +402,7 @@ rpc_cli_recvBLOB(rpc_cli_t * __restrict cli, rpc_val_t *data = NULL; return -1; } - if (read(cli->cli_sock, &hdr, sizeof hdr) == -1) { + if (recv(cli->cli_sock, &hdr, sizeof hdr, 0) == -1) { LOGERR; free(*data); *data = NULL; @@ -443,7 +443,7 @@ rpc_cli_delBLOB(rpc_cli_t * __restrict cli, rpc_val_t hdr.hdr_var = (uint32_t) RPC_GET_BLOB(var); hdr.hdr_ret = 0; hdr.hdr_len = 0; - if (write(cli->cli_sock, &hdr, sizeof hdr) == -1) { + if (send(cli->cli_sock, &hdr, sizeof hdr, 0) == -1) { LOGERR; return -1; } @@ -458,7 +458,7 @@ rpc_cli_delBLOB(rpc_cli_t * __restrict cli, rpc_val_t rpc_SetErr(ETIMEDOUT, "Error:: Timeout reached! Server not responde ...\n"); return -1; } - if (read(cli->cli_sock, &hdr, sizeof hdr) == -1) { + if (recv(cli->cli_sock, &hdr, sizeof hdr, 0) == -1) { LOGERR; return -1; }