summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-07-11 16:25:18 +0200
committerStefan Metzmacher <metze@samba.org>2011-07-11 18:18:23 +0200
commitfa60a299f5621ca06b25e64d552a85f846d7f0f2 (patch)
tree0836c38f071a5e3413be497793dc4c534c59ff60
parent2b70c0f4f39d2ab7e678e91bc57a2e5980dbc816 (diff)
downloadsamba-fa60a299f5621ca06b25e64d552a85f846d7f0f2.tar.gz
samba-fa60a299f5621ca06b25e64d552a85f846d7f0f2.tar.bz2
samba-fa60a299f5621ca06b25e64d552a85f846d7f0f2.zip
s3:libsmb: make use of cli_state_is_connected()
metze
-rw-r--r--source3/libsmb/clierror.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/source3/libsmb/clierror.c b/source3/libsmb/clierror.c
index 7541a69010..52f4c03fe5 100644
--- a/source3/libsmb/clierror.c
+++ b/source3/libsmb/clierror.c
@@ -45,7 +45,7 @@ const char *cli_errstr(struct cli_state *cli)
goto done;
}
- if (cli->fd == -1 && NT_STATUS_IS_OK(cli->raw_status)) {
+ if (!cli_state_is_connected(cli) && NT_STATUS_IS_OK(cli->raw_status)) {
return nt_errstr(NT_STATUS_CONNECTION_DISCONNECTED);
}
@@ -64,7 +64,7 @@ const char *cli_errstr(struct cli_state *cli)
NTSTATUS cli_nt_error(struct cli_state *cli)
{
/* Deal with socket errors first. */
- if (cli->fd == -1) {
+ if (!cli_state_is_connected(cli)) {
return NT_STATUS_CONNECTION_DISCONNECTED;
}
@@ -85,11 +85,7 @@ NTSTATUS cli_nt_error(struct cli_state *cli)
void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode)
{
- if(!cli->initialised) {
- return;
- }
-
- if (cli->fd == -1) {
+ if (!cli_state_is_connected(cli)) {
*eclass = ERRDOS;
*ecode = ERRnotconnected;
return;
@@ -144,8 +140,8 @@ int cli_errno(struct cli_state *cli)
bool cli_is_error(struct cli_state *cli)
{
/* A socket error is always an error. */
- if (cli->fd == -1) {
- return True;
+ if (!cli_state_is_connected(cli)) {
+ return true;
}
if (NT_STATUS_IS_DOS(cli->raw_status)) {
@@ -162,8 +158,8 @@ bool cli_is_error(struct cli_state *cli)
bool cli_is_nt_error(struct cli_state *cli)
{
/* A socket error is always an NT error. */
- if (cli->fd == -1) {
- return True;
+ if (!cli_state_is_connected(cli)) {
+ return true;
}
return cli_is_error(cli) && !NT_STATUS_IS_DOS(cli->raw_status);
@@ -174,8 +170,8 @@ bool cli_is_nt_error(struct cli_state *cli)
bool cli_is_dos_error(struct cli_state *cli)
{
/* A socket error is always a DOS error. */
- if (cli->fd == -1) {
- return True;
+ if (!cli_state_is_connected(cli)) {
+ return true;
}
return cli_is_error(cli) && NT_STATUS_IS_DOS(cli->raw_status);