summaryrefslogtreecommitdiffstats
path: root/source3/libsmb/libsmb_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libsmb/libsmb_file.c')
-rw-r--r--source3/libsmb/libsmb_file.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c
index 58403dfbb36..c822eab7985 100644
--- a/source3/libsmb/libsmb_file.c
+++ b/source3/libsmb/libsmb_file.c
@@ -23,6 +23,7 @@
*/
#include "includes.h"
+#include "libsmb/libsmb.h"
#include "libsmbclient.h"
#include "libsmb_internal.h"
@@ -318,13 +319,13 @@ SMBC_write_ctx(SMBCCTX *context,
const void *buf,
size_t count)
{
- int ret;
off_t offset;
char *server = NULL, *share = NULL, *user = NULL, *password = NULL;
char *path = NULL;
char *targetpath = NULL;
struct cli_state *targetcli = NULL;
TALLOC_CTX *frame = talloc_stackframe();
+ NTSTATUS status;
/* First check all pointers before dereferencing them */
@@ -377,18 +378,18 @@ SMBC_write_ctx(SMBCCTX *context,
}
/*d_printf(">>>write: resolved path as %s\n", targetpath);*/
- ret = cli_write(targetcli, file->cli_fd,
- 0, (char *)buf, offset, count);
- if (ret <= 0) {
- errno = SMBC_errno(context, targetcli);
+ status = cli_writeall(targetcli, file->cli_fd,
+ 0, (const uint8_t *)buf, offset, count, NULL);
+ if (!NT_STATUS_IS_OK(status)) {
+ errno = map_errno_from_nt_status(status);
TALLOC_FREE(frame);
return -1;
}
- file->offset += ret;
+ file->offset += count;
TALLOC_FREE(frame);
- return ret; /* Success, 0 bytes of data ... */
+ return count; /* Success, 0 bytes of data ... */
}
/*
@@ -480,7 +481,7 @@ SMBC_close_ctx(SMBCCTX *context,
bool
SMBC_getatr(SMBCCTX * context,
SMBCSRV *srv,
- char *path,
+ const char *path,
uint16 *mode,
SMB_OFF_T *size,
struct timespec *create_time_ts,