s3: Avoid a few calls to cli_errstr
authorVolker Lendecke <vl@samba.org>
Sun, 16 Jan 2011 20:13:29 +0000 (21:13 +0100)
committerVolker Lendecke <vlendec@samba.org>
Mon, 17 Jan 2011 07:47:25 +0000 (08:47 +0100)
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Mon Jan 17 08:47:25 CET 2011 on sn-devel-104

source3/auth/auth_server.c
source3/client/smbspool.c

index ac757d5a3522386a0abc0a704e74b546b34b0b24..fc46ce014862a3c076585a0865474a928225a768 100644 (file)
@@ -135,11 +135,11 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
           this one...
        */
 
-       if (!NT_STATUS_IS_OK(cli_session_setup(cli, "", "", 0, "", 0,
-                                              ""))) {
+       status = cli_session_setup(cli, "", "", 0, "", 0, "");
+       if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(mutex);
                DEBUG(0,("%s rejected the initial session setup (%s)\n",
-                        desthost, cli_errstr(cli)));
+                        desthost, nt_errstr(status)));
                cli_shutdown(cli);
                return NULL;
        }
index 0804eb56ec839644e23c9c060baf9594ac2ef096..c80ad42dd914c507379c7efc956cf01a628349dd 100644 (file)
@@ -558,6 +558,7 @@ smb_print(struct cli_state * cli,   /* I - SMB connection */
                        tbytes; /* Total bytes read */
        char            buffer[8192],   /* Buffer for copy */
                       *ptr;    /* Pointer into title */
+       NTSTATUS nt_status;
 
 
        /*
@@ -574,10 +575,12 @@ smb_print(struct cli_state * cli, /* I - SMB connection */
          * Open the printer device...
          */
 
-       if (!NT_STATUS_IS_OK(cli_open(cli, title, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE, &fnum))) {
+       nt_status = cli_open(cli, title, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE,
+                         &fnum);
+       if (!NT_STATUS_IS_OK(nt_status)) {
                fprintf(stderr, "ERROR: %s opening remote spool %s\n",
-                       cli_errstr(cli), title);
-               return (get_exit_code(cli, cli_nt_error(cli)));
+                       nt_errstr(nt_status), title);
+               return get_exit_code(cli, nt_status);
        }
 
        /*
@@ -602,10 +605,11 @@ smb_print(struct cli_state * cli, /* I - SMB connection */
                tbytes += nbytes;
        }
 
-       if (!NT_STATUS_IS_OK(cli_close(cli, fnum))) {
+       nt_status = cli_close(cli, fnum);
+       if (!NT_STATUS_IS_OK(nt_status)) {
                fprintf(stderr, "ERROR: %s closing remote spool %s\n",
-                       cli_errstr(cli), title);
-               return (get_exit_code(cli, cli_nt_error(cli)));
+                       nt_errstr(nt_status), title);
+               return get_exit_code(cli, nt_status);
        } else {
                return (0);
        }