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

Commit68d6b3b

Browse files
committed
Correctly handle spaces in path for remote backup
1 parent04d396d commit68d6b3b

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

‎src/utils/remote.c‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ void launch_ssh(char* argv[])
7676
}
7777
#endif
7878

79+
staticboolneeds_quotes(charconst*path)
80+
{
81+
returnstrchr(path,' ')!=NULL;
82+
}
7983

8084
boollaunch_agent(void)
8185
{
@@ -137,14 +141,25 @@ bool launch_agent(void)
137141
probackup=sep+1;
138142
}
139143
}
140-
snprintf(cmd,sizeof(cmd),"%s\\%s agent %s",
141-
instance_config.remote.path,probackup,PROGRAM_VERSION);
144+
if (needs_quotes(instance_config.remote.path)||needs_quotes(pg_probackup))
145+
snprintf(cmd,sizeof(cmd),"\"%s\\%s\" agent %s",
146+
instance_config.remote.path,probackup,PROGRAM_VERSION);
147+
else
148+
snprintf(cmd,sizeof(cmd),"%s\\%s agent %s",
149+
instance_config.remote.path,probackup,PROGRAM_VERSION);
142150
#else
143-
snprintf(cmd,sizeof(cmd),"%s/%s agent %s",
144-
instance_config.remote.path,probackup,PROGRAM_VERSION);
151+
if (needs_quotes(instance_config.remote.path)||needs_quotes(pg_probackup))
152+
snprintf(cmd,sizeof(cmd),"\"%s/%s\" agent %s",
153+
instance_config.remote.path,probackup,PROGRAM_VERSION);
154+
else
155+
snprintf(cmd,sizeof(cmd),"%s/%s agent %s",
156+
instance_config.remote.path,probackup,PROGRAM_VERSION);
145157
#endif
146158
}else {
147-
snprintf(cmd,sizeof(cmd),"%s agent %s",pg_probackup,PROGRAM_VERSION);
159+
if (needs_quotes(pg_probackup))
160+
snprintf(cmd,sizeof(cmd),"\"%s\" agent %s",pg_probackup,PROGRAM_VERSION);
161+
else
162+
snprintf(cmd,sizeof(cmd),"%s agent %s",pg_probackup,PROGRAM_VERSION);
148163
}
149164

150165
#ifdefWIN32

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp