r1320: Return an error when the last command read from stdin fails in smbclient +
authorJelmer Vernooij <jelmer@samba.org>
Thu, 1 Jul 2004 20:20:06 +0000 (20:20 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:52:06 +0000 (10:52 -0500)
prepare for better error checking in tar..

source/client/client.c
source/client/clitar.c

index ea8ec93f97cd0058e2f3d3b6b911e0a82d1005de..1fccfaa581ca0d33ee97a839bc41b9b9811af225 100644 (file)
@@ -2579,9 +2579,10 @@ static void readline_callback(void)
  Process commands on stdin.
 ****************************************************************************/
 
-static void process_stdin(void)
+static int process_stdin(void)
 {
        const char *ptr;
+       int rc = 0;
 
        while (1) {
                pstring tok;
@@ -2609,13 +2610,14 @@ static void process_stdin(void)
                if (!next_token_nr(&ptr,tok,NULL,sizeof(tok))) continue;
 
                if ((i = process_tok(tok)) >= 0) {
-                       commands[i].fn();
+                       rc = commands[i].fn();
                } else if (i == -2) {
                        d_printf("%s: command abbreviation ambiguous\n",tok);
                } else {
                        d_printf("%s: command not found\n",tok);
                }
        }
+       return rc;
 }
 
 /***************************************************** 
index e43b3e4cc50bee204166c43d70e5d2e6b014f265..64c194b54dae7d91997e3fcd7b985083c2bcdbee 100644 (file)
@@ -1357,9 +1357,8 @@ int cmd_tar(void)
        if (!tar_parseargs(argcl, argl, buf, 0))
                return 1;
 
-       process_tar();
        SAFE_FREE(argl);
-       return 0;
+       return process_tar();
 }
 
 /****************************************************************************
@@ -1368,6 +1367,7 @@ Command line (option) version
 
 int process_tar(void)
 {
+       int rc = 0;
        initarbuf();
        switch(tar_type) {
                case 'x':
@@ -1445,7 +1445,7 @@ int process_tar(void)
                clipn = 0;
                must_free_cliplist = False;
        }
-       return(0);
+       return rc;
 }
 
 /****************************************************************************