Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 274601
Collapse All | Expand All

(-)a/source/client/client.c (-21 / +20 lines)
Lines 364-370 static int do_cd(const char *new_dir) Link Here
364
364
365
	/* Ensure cur_dir ends in a DIRSEP */
365
	/* Ensure cur_dir ends in a DIRSEP */
366
	if ((new_cd[0] != '\0') && (*(new_cd+strlen(new_cd)-1) != CLI_DIRSEP_CHAR)) {
366
	if ((new_cd[0] != '\0') && (*(new_cd+strlen(new_cd)-1) != CLI_DIRSEP_CHAR)) {
367
		new_cd = talloc_asprintf_append(new_cd, CLI_DIRSEP_STR);
367
		new_cd = talloc_asprintf_append(new_cd, "%s", CLI_DIRSEP_STR);
368
		if (!new_cd) {
368
		if (!new_cd) {
369
			goto out;
369
			goto out;
370
		}
370
		}
Lines 871-877 static int cmd_dir(void) Link Here
871
		if (*buf == CLI_DIRSEP_CHAR) {
871
		if (*buf == CLI_DIRSEP_CHAR) {
872
			mask = talloc_strdup(ctx, buf);
872
			mask = talloc_strdup(ctx, buf);
873
		} else {
873
		} else {
874
			mask = talloc_asprintf_append(mask, buf);
874
			mask = talloc_asprintf_append(mask, "%s", buf);
875
		}
875
		}
876
	} else {
876
	} else {
877
		mask = talloc_asprintf_append(mask, "*");
877
		mask = talloc_asprintf_append(mask, "*");
Lines 912-918 static int cmd_du(void) Link Here
912
		return 1;
912
		return 1;
913
	}
913
	}
914
	if ((mask[0] != '\0') && (mask[strlen(mask)-1]!=CLI_DIRSEP_CHAR)) {
914
	if ((mask[0] != '\0') && (mask[strlen(mask)-1]!=CLI_DIRSEP_CHAR)) {
915
		mask = talloc_asprintf_append(mask, CLI_DIRSEP_STR);
915
		mask = talloc_asprintf_append(mask, "%s", CLI_DIRSEP_STR);
916
		if (!mask) {
916
		if (!mask) {
917
			return 1;
917
			return 1;
918
		}
918
		}
Lines 923-929 static int cmd_du(void) Link Here
923
		if (*buf == CLI_DIRSEP_CHAR) {
923
		if (*buf == CLI_DIRSEP_CHAR) {
924
			mask = talloc_strdup(ctx, buf);
924
			mask = talloc_strdup(ctx, buf);
925
		} else {
925
		} else {
926
			mask = talloc_asprintf_append(mask, buf);
926
			mask = talloc_asprintf_append(mask, "%s", buf);
927
		}
927
		}
928
	} else {
928
	} else {
929
		mask = talloc_strdup(ctx, "*");
929
		mask = talloc_strdup(ctx, "*");
Lines 1107-1113 static int cmd_get(void) Link Here
1107
		d_printf("get <filename> [localname]\n");
1107
		d_printf("get <filename> [localname]\n");
1108
		return 1;
1108
		return 1;
1109
	}
1109
	}
1110
	rname = talloc_asprintf_append(rname, fname);
1110
	rname = talloc_asprintf_append(rname, "%s", fname);
1111
	if (!rname) {
1111
	if (!rname) {
1112
		return 1;
1112
		return 1;
1113
	}
1113
	}
Lines 1266-1272 static int cmd_more(void) Link Here
1266
		unlink(lname);
1266
		unlink(lname);
1267
		return 1;
1267
		return 1;
1268
	}
1268
	}
1269
	rname = talloc_asprintf_append(rname, fname);
1269
	rname = talloc_asprintf_append(rname, "%s", fname);
1270
	if (!rname) {
1270
	if (!rname) {
1271
		return 1;
1271
		return 1;
1272
	}
1272
	}
Lines 1318-1324 static int cmd_mget(void) Link Here
1318
			mget_mask = talloc_strdup(ctx, buf);
1318
			mget_mask = talloc_strdup(ctx, buf);
1319
		} else {
1319
		} else {
1320
			mget_mask = talloc_asprintf_append(mget_mask,
1320
			mget_mask = talloc_asprintf_append(mget_mask,
1321
							buf);
1321
							"%s", buf);
1322
		}
1322
		}
1323
		if (!mget_mask) {
1323
		if (!mget_mask) {
1324
			return 1;
1324
			return 1;
Lines 1419-1425 static int cmd_mkdir(void) Link Here
1419
		}
1419
		}
1420
		return 1;
1420
		return 1;
1421
	}
1421
	}
1422
	mask = talloc_asprintf_append(mask, buf);
1422
	mask = talloc_asprintf_append(mask, "%s", buf);
1423
	if (!mask) {
1423
	if (!mask) {
1424
		return 1;
1424
		return 1;
1425
	}
1425
	}
Lines 1448-1461 static int cmd_mkdir(void) Link Here
1448
		trim_char(ddir,'.','\0');
1448
		trim_char(ddir,'.','\0');
1449
		p = strtok_r(ddir, "/\\", &saveptr);
1449
		p = strtok_r(ddir, "/\\", &saveptr);
1450
		while (p) {
1450
		while (p) {
1451
			ddir2 = talloc_asprintf_append(ddir2, p);
1451
			ddir2 = talloc_asprintf_append(ddir2, "%s", p);
1452
			if (!ddir2) {
1452
			if (!ddir2) {
1453
				return 1;
1453
				return 1;
1454
			}
1454
			}
1455
			if (!cli_chkpath(targetcli, ddir2)) {
1455
			if (!cli_chkpath(targetcli, ddir2)) {
1456
				do_mkdir(ddir2);
1456
				do_mkdir(ddir2);
1457
			}
1457
			}
1458
			ddir2 = talloc_asprintf_append(ddir2, CLI_DIRSEP_STR);
1458
			ddir2 = talloc_asprintf_append(ddir2, "%s", CLI_DIRSEP_STR);
1459
			if (!ddir2) {
1459
			if (!ddir2) {
1460
				return 1;
1460
				return 1;
1461
			}
1461
			}
Lines 1487-1493 static int cmd_altname(void) Link Here
1487
		d_printf("altname <file>\n");
1487
		d_printf("altname <file>\n");
1488
		return 1;
1488
		return 1;
1489
	}
1489
	}
1490
	name = talloc_asprintf_append(name, buf);
1490
	name = talloc_asprintf_append(name, "%s", buf);
1491
	if (!name) {
1491
	if (!name) {
1492
		return 1;
1492
		return 1;
1493
	}
1493
	}
Lines 1571-1577 static int cmd_allinfo(void) Link Here
1571
		d_printf("allinfo <file>\n");
1571
		d_printf("allinfo <file>\n");
1572
		return 1;
1572
		return 1;
1573
	}
1573
	}
1574
	name = talloc_asprintf_append(name, buf);
1574
	name = talloc_asprintf_append(name, "%s", buf);
1575
	if (!name) {
1575
	if (!name) {
1576
		return 1;
1576
		return 1;
1577
	}
1577
	}
Lines 1738-1746 static int cmd_put(void) Link Here
1738
	}
1738
	}
1739
1739
1740
	if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
1740
	if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
1741
		rname = talloc_asprintf_append(rname, buf);
1741
		rname = talloc_asprintf_append(rname, "%s", buf);
1742
	} else {
1742
	} else {
1743
		rname = talloc_asprintf_append(rname, lname);
1743
		rname = talloc_asprintf_append(rname, "%s", lname);
1744
	}
1744
	}
1745
	if (!rname) {
1745
	if (!rname) {
1746
		return 1;
1746
		return 1;
Lines 2137-2143 static int cmd_del(void) Link Here
2137
		d_printf("del <filename>\n");
2137
		d_printf("del <filename>\n");
2138
		return 1;
2138
		return 1;
2139
	}
2139
	}
2140
	mask = talloc_asprintf_append(mask, buf);
2140
	mask = talloc_asprintf_append(mask, "%s", buf);
2141
	if (!mask) {
2141
	if (!mask) {
2142
		return 1;
2142
		return 1;
2143
	}
2143
	}
Lines 3529-3535 static int cmd_reget(void) Link Here
3529
		d_printf("reget <filename>\n");
3529
		d_printf("reget <filename>\n");
3530
		return 1;
3530
		return 1;
3531
	}
3531
	}
3532
	remote_name = talloc_asprintf_append(remote_name, fname);
3532
	remote_name = talloc_asprintf_append(remote_name, "%s", fname);
3533
	if (!remote_name) {
3533
	if (!remote_name) {
3534
		return 1;
3534
		return 1;
3535
	}
3535
	}
Lines 3576-3585 static int cmd_reput(void) Link Here
3576
3576
3577
	if (next_token_talloc(ctx, &cmd_ptr, &buf, NULL)) {
3577
	if (next_token_talloc(ctx, &cmd_ptr, &buf, NULL)) {
3578
		remote_name = talloc_asprintf_append(remote_name,
3578
		remote_name = talloc_asprintf_append(remote_name,
3579
						buf);
3579
						"%s", buf);
3580
	} else {
3580
	} else {
3581
		remote_name = talloc_asprintf_append(remote_name,
3581
		remote_name = talloc_asprintf_append(remote_name,
3582
						local_name);
3582
						"%s", local_name);
3583
	}
3583
	}
3584
	if (!remote_name) {
3584
	if (!remote_name) {
3585
		return 1;
3585
		return 1;
Lines 4112-4124 static void completion_remote_filter(const char *mnt, Link Here
4112
				TALLOC_FREE(ctx);
4112
				TALLOC_FREE(ctx);
4113
				return;
4113
				return;
4114
			}
4114
			}
4115
			tmp = talloc_asprintf_append(tmp, f->name);
4115
			tmp = talloc_asprintf_append(tmp, "%s", f->name);
4116
			if (!tmp) {
4116
			if (!tmp) {
4117
				TALLOC_FREE(ctx);
4117
				TALLOC_FREE(ctx);
4118
				return;
4118
				return;
4119
			}
4119
			}
4120
			if (f->mode & aDIR) {
4120
			if (f->mode & aDIR) {
4121
				tmp = talloc_asprintf_append(tmp, CLI_DIRSEP_STR);
4121
				tmp = talloc_asprintf_append(tmp, "%s", CLI_DIRSEP_STR);
4122
			}
4122
			}
4123
			if (!tmp) {
4123
			if (!tmp) {
4124
				TALLOC_FREE(ctx);
4124
				TALLOC_FREE(ctx);
4125
- 

Return to bug 274601