summaryrefslogtreecommitdiff
path: root/source3/client
diff options
context:
space:
mode:
Diffstat (limited to 'source3/client')
-rw-r--r--source3/client/client.c60
1 files changed, 36 insertions, 24 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 03bc15c68ce..c63921aa1af 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -382,7 +382,7 @@ static int do_cd(const char *new_dir)
/* Ensure cur_dir ends in a DIRSEP */
if ((new_cd[0] != '\0') && (*(new_cd+strlen(new_cd)-1) != CLI_DIRSEP_CHAR)) {
- new_cd = talloc_asprintf_append(new_cd, CLI_DIRSEP_STR);
+ new_cd = talloc_asprintf_append(new_cd, "%s", CLI_DIRSEP_STR);
if (!new_cd) {
goto out;
}
@@ -889,7 +889,7 @@ static int cmd_dir(void)
if (*buf == CLI_DIRSEP_CHAR) {
mask = talloc_strdup(ctx, buf);
} else {
- mask = talloc_asprintf_append(mask, buf);
+ mask = talloc_asprintf_append(mask, "%s", buf);
}
} else {
mask = talloc_asprintf_append(mask, "*");
@@ -930,7 +930,7 @@ static int cmd_du(void)
return 1;
}
if ((mask[0] != '\0') && (mask[strlen(mask)-1]!=CLI_DIRSEP_CHAR)) {
- mask = talloc_asprintf_append(mask, CLI_DIRSEP_STR);
+ mask = talloc_asprintf_append(mask, "%s", CLI_DIRSEP_STR);
if (!mask) {
return 1;
}
@@ -941,7 +941,7 @@ static int cmd_du(void)
if (*buf == CLI_DIRSEP_CHAR) {
mask = talloc_strdup(ctx, buf);
} else {
- mask = talloc_asprintf_append(mask, buf);
+ mask = talloc_asprintf_append(mask, "%s", buf);
}
} else {
mask = talloc_strdup(ctx, "*");
@@ -1127,7 +1127,7 @@ static int cmd_get(void)
d_printf("get <filename> [localname]\n");
return 1;
}
- rname = talloc_asprintf_append(rname, fname);
+ rname = talloc_asprintf_append(rname, "%s", fname);
if (!rname) {
return 1;
}
@@ -1243,7 +1243,10 @@ static void do_mget(file_info *finfo, const char *dir)
}
do_list(mget_mask, aSYSTEM | aHIDDEN | aDIR,do_mget,false, true);
- chdir("..");
+ if (chdir("..") == -1) {
+ d_printf("do_mget: failed to chdir to .. (error %s)\n",
+ strerror(errno) );
+ }
client_set_cur_dir(saved_curdir);
TALLOC_FREE(mget_mask);
TALLOC_FREE(saved_curdir);
@@ -1286,7 +1289,7 @@ static int cmd_more(void)
unlink(lname);
return 1;
}
- rname = talloc_asprintf_append(rname, fname);
+ rname = talloc_asprintf_append(rname, "%s", fname);
if (!rname) {
return 1;
}
@@ -1306,7 +1309,10 @@ static int cmd_more(void)
if (!pager_cmd) {
return 1;
}
- system(pager_cmd);
+ if (system(pager_cmd) == -1) {
+ d_printf("system command '%s' returned -1\n",
+ pager_cmd);
+ }
unlink(lname);
return rc;
@@ -1338,7 +1344,7 @@ static int cmd_mget(void)
mget_mask = talloc_strdup(ctx, buf);
} else {
mget_mask = talloc_asprintf_append(mget_mask,
- buf);
+ "%s", buf);
}
if (!mget_mask) {
return 1;
@@ -1434,7 +1440,7 @@ static int cmd_mkdir(void)
}
return 1;
}
- mask = talloc_asprintf_append(mask, buf);
+ mask = talloc_asprintf_append(mask, "%s", buf);
if (!mask) {
return 1;
}
@@ -1463,14 +1469,14 @@ static int cmd_mkdir(void)
trim_char(ddir,'.','\0');
p = strtok_r(ddir, "/\\", &saveptr);
while (p) {
- ddir2 = talloc_asprintf_append(ddir2, p);
+ ddir2 = talloc_asprintf_append(ddir2, "%s", p);
if (!ddir2) {
return 1;
}
if (!cli_chkpath(targetcli, ddir2)) {
do_mkdir(ddir2);
}
- ddir2 = talloc_asprintf_append(ddir2, CLI_DIRSEP_STR);
+ ddir2 = talloc_asprintf_append(ddir2, "%s", CLI_DIRSEP_STR);
if (!ddir2) {
return 1;
}
@@ -1502,7 +1508,7 @@ static int cmd_altname(void)
d_printf("altname <file>\n");
return 1;
}
- name = talloc_asprintf_append(name, buf);
+ name = talloc_asprintf_append(name, "%s", buf);
if (!name) {
return 1;
}
@@ -1586,7 +1592,7 @@ static int cmd_allinfo(void)
d_printf("allinfo <file>\n");
return 1;
}
- name = talloc_asprintf_append(name, buf);
+ name = talloc_asprintf_append(name, "%s", buf);
if (!name) {
return 1;
}
@@ -1731,9 +1737,9 @@ static int cmd_put(void)
}
if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
- rname = talloc_asprintf_append(rname, buf);
+ rname = talloc_asprintf_append(rname, "%s", buf);
} else {
- rname = talloc_asprintf_append(rname, lname);
+ rname = talloc_asprintf_append(rname, "%s", lname);
}
if (!rname) {
return 1;
@@ -2130,7 +2136,7 @@ static int cmd_del(void)
d_printf("del <filename>\n");
return 1;
}
- mask = talloc_asprintf_append(mask, buf);
+ mask = talloc_asprintf_append(mask, "%s", buf);
if (!mask) {
return 1;
}
@@ -3491,7 +3497,10 @@ static int cmd_lcd(void)
char *d;
if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
- chdir(buf);
+ if (chdir(buf) == -1) {
+ d_printf("chdir to %s failed (%s)\n",
+ buf, strerror(errno));
+ }
}
d = TALLOC_ARRAY(ctx, char, PATH_MAX+1);
if (!d) {
@@ -3522,7 +3531,7 @@ static int cmd_reget(void)
d_printf("reget <filename>\n");
return 1;
}
- remote_name = talloc_asprintf_append(remote_name, fname);
+ remote_name = talloc_asprintf_append(remote_name, "%s", fname);
if (!remote_name) {
return 1;
}
@@ -3569,10 +3578,10 @@ static int cmd_reput(void)
if (next_token_talloc(ctx, &cmd_ptr, &buf, NULL)) {
remote_name = talloc_asprintf_append(remote_name,
- buf);
+ "%s", buf);
} else {
remote_name = talloc_asprintf_append(remote_name,
- local_name);
+ "%s", local_name);
}
if (!remote_name) {
return 1;
@@ -4106,13 +4115,13 @@ static void completion_remote_filter(const char *mnt,
TALLOC_FREE(ctx);
return;
}
- tmp = talloc_asprintf_append(tmp, f->name);
+ tmp = talloc_asprintf_append(tmp, "%s", f->name);
if (!tmp) {
TALLOC_FREE(ctx);
return;
}
if (f->mode & aDIR) {
- tmp = talloc_asprintf_append(tmp, CLI_DIRSEP_STR);
+ tmp = talloc_asprintf_append(tmp, "%s", CLI_DIRSEP_STR);
}
if (!tmp) {
TALLOC_FREE(ctx);
@@ -4460,7 +4469,10 @@ static int process_stdin(void)
/* special case - first char is ! */
if (*line == '!') {
- system(line + 1);
+ if (system(line + 1) == -1) {
+ d_printf("system() command %s failed.\n",
+ line+1);
+ }
SAFE_FREE(line);
TALLOC_FREE(frame);
continue;