Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8659fc6

Browse files
committed
Fix passing options with spaces to remote backup
1 parent66ebfcb commit8659fc6

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

‎src/utils/remote.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,21 @@
1515
staticintappend_option(char*buf,size_tbuf_size,size_tdst,charconst*src)
1616
{
1717
size_tlen=strlen(src);
18-
if (dst+len+1 >=buf_size) {
18+
if (dst+len+3 >=buf_size) {
1919
fprintf(stderr,"Too long command line\n");
2020
exit(EXIT_FAILURE);
2121
}
22-
buf[dst]=' ';
23-
memcpy(&buf[dst+1],src,len);
24-
returndst+len+1;
22+
buf[dst++]=' ';
23+
if (strchr(src,' ')!=NULL) {/* need quotes */
24+
buf[dst++]='\'';
25+
memcpy(&buf[dst],src,len);
26+
dst+=len;
27+
buf[dst++]='\'';
28+
}else {
29+
memcpy(&buf[dst],src,len);
30+
dst+=len;
31+
}
32+
returndst;
2533
}
2634

2735
staticintsplit_options(intargc,char*argv[],intmax_options,char*options)
@@ -93,7 +101,7 @@ int remote_execute(int argc, char* argv[], bool listen)
93101
ssh_argv[ssh_argc++]=instance_config.remote.ssh_config;
94102
}
95103
if (instance_config.remote.ssh_options!=NULL) {
96-
ssh_argc=split_options(ssh_argc,ssh_argv,MAX_CMDLINE_OPTIONS,instance_config.remote.ssh_options);
104+
ssh_argc=split_options(ssh_argc,ssh_argv,MAX_CMDLINE_OPTIONS,pg_strdup(instance_config.remote.ssh_options));
97105
}
98106
ssh_argv[ssh_argc++]=instance_config.remote.host;
99107
ssh_argv[ssh_argc++]=cmd;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp