summaryrefslogtreecommitdiff
path: root/source4/client
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2016-04-05 19:26:41 +0200
committerMichael Adam <obnox@samba.org>2016-05-13 00:16:16 +0200
commit33d20f93dc38514f0174b978e019533373d8118a (patch)
tree3800108831739a7e04139a72f697dcf20de7e458 /source4/client
parenta7fc5e0f4dd8f172662f06735020aa6d4d913254 (diff)
downloadsamba-33d20f93dc38514f0174b978e019533373d8118a.tar.gz
s4:client: fix O3 error unused result of of chdir and system
Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Christian Ambach <ambi@samba.org>
Diffstat (limited to 'source4/client')
-rw-r--r--source4/client/client.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/source4/client/client.c b/source4/client/client.c
index a069443d0cf..4807123b50f 100644
--- a/source4/client/client.c
+++ b/source4/client/client.c
@@ -874,6 +874,7 @@ static void do_mget(struct smbclient_context *ctx, struct clilist_file_info *fin
char *mget_mask;
char *saved_curdir;
char *l_fname;
+ int ret;
if (ISDOT(finfo->name) || ISDOTDOT(finfo->name))
return;
@@ -922,7 +923,11 @@ static void do_mget(struct smbclient_context *ctx, struct clilist_file_info *fin
mget_mask = talloc_asprintf(ctx, "%s*", ctx->remote_cur_dir);
do_list(ctx, mget_mask, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY,do_mget,false, true);
- chdir("..");
+ ret = chdir("..");
+ if (ret == -1) {
+ d_printf("failed to chdir to '..': %s\n", strerror(errno));
+ return;
+ }
talloc_free(ctx->remote_cur_dir);
ctx->remote_cur_dir = saved_curdir;
@@ -965,7 +970,11 @@ static int cmd_more(struct smbclient_context *ctx, const char **args)
pager=getenv("PAGER");
pager_cmd = talloc_asprintf(ctx, "%s %s",(pager? pager:DEFAULT_PAGER), lname);
- system(pager_cmd);
+ rc = system(pager_cmd);
+ if (rc == -1) {
+ d_printf("failed to call pager command\n");
+ return 1;
+ }
unlink(lname);
return rc;
@@ -2540,8 +2549,17 @@ static int cmd_lcd(struct smbclient_context *ctx, const char **args)
{
char d[PATH_MAX];
- if (args[1])
- chdir(args[1]);
+ if (args[1]) {
+ int ret;
+
+ ret = chdir(args[1]);
+ if (ret == -1) {
+ d_printf("failed to chdir to dir '%s': %s\n",
+ args[1], strerror(errno));
+ return 1;
+ }
+ }
+
DEBUG(2,("the local directory is now %s\n",getcwd(d, PATH_MAX)));
return 0;
@@ -3138,8 +3156,12 @@ static int process_stdin(struct smbclient_context *ctx)
/* special case - first char is ! */
if (*cline == '!') {
- system(cline + 1);
+ int ret;
+ ret = system(cline + 1);
free(cline);
+ if (ret == -1) {
+ rc |= ret;
+ }
continue;
}