diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
commit | 6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch) | |
tree | 850c71039563c16a5d563c47e7ba2ab645baf198 /source3/libsmb/libsmb_file.c | |
parent | 6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff) | |
parent | 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff) | |
download | samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.gz samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.bz2 samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.zip |
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16
Diffstat (limited to 'source3/libsmb/libsmb_file.c')
-rw-r--r-- | source3/libsmb/libsmb_file.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c index 58403dfbb3..c822eab798 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, |