Fossil SCM

Fix a typo in the popen2() implementation for windows. Ticket [cf50ea4d6914fb6d856988da7]. Also refinements on the ssh:// toward getting it working on windows.

drh 2010-08-27 17:19 trunk
Commit d5c934e5df81f88878f3f9666ac5e96c3081cb9a
2 files changed +7 -5 +1 -1
--- src/http_transport.c
+++ src/http_transport.c
@@ -93,19 +93,21 @@
9393
/*
9494
** Global initialization of the transport layer
9595
*/
9696
void transport_global_startup(void){
9797
if( g.urlIsSsh ){
98
+#ifdef __MINGW32__
99
+ static const char *zSshCmd = "ssh";
100
+#else
101
+ static const char *zSshCmd = "ssh -e none";
102
+#endif
98103
char *zCmd;
99104
char zIn[20];
100
-#ifdef __MINGW32__
101
- fossil_fatal("the ssh:// sync method is currently only supported on unix");
102
-#endif
103105
if( g.urlUser && g.urlUser[0] ){
104
- zCmd = mprintf("ssh -e none %s@%s", g.urlUser, g.urlName);
106
+ zCmd = mprintf("%s %s@%s", zSshCmd, g.urlUser, g.urlName);
105107
}else{
106
- zCmd = mprintf("ssh -e none %s", g.urlName);
108
+ zCmd = mprintf("%s %s", zSshCmd, g.urlName);
107109
}
108110
/* printf("%s\n", zCmd); */
109111
popen2(zCmd, &sshIn, &sshOut, &sshPid);
110112
if( sshPid==0 ){
111113
fossil_fatal("cannot start ssh tunnel using [%s]", zCmd);
112114
--- src/http_transport.c
+++ src/http_transport.c
@@ -93,19 +93,21 @@
93 /*
94 ** Global initialization of the transport layer
95 */
96 void transport_global_startup(void){
97 if( g.urlIsSsh ){
 
 
 
 
 
98 char *zCmd;
99 char zIn[20];
100 #ifdef __MINGW32__
101 fossil_fatal("the ssh:// sync method is currently only supported on unix");
102 #endif
103 if( g.urlUser && g.urlUser[0] ){
104 zCmd = mprintf("ssh -e none %s@%s", g.urlUser, g.urlName);
105 }else{
106 zCmd = mprintf("ssh -e none %s", g.urlName);
107 }
108 /* printf("%s\n", zCmd); */
109 popen2(zCmd, &sshIn, &sshOut, &sshPid);
110 if( sshPid==0 ){
111 fossil_fatal("cannot start ssh tunnel using [%s]", zCmd);
112
--- src/http_transport.c
+++ src/http_transport.c
@@ -93,19 +93,21 @@
93 /*
94 ** Global initialization of the transport layer
95 */
96 void transport_global_startup(void){
97 if( g.urlIsSsh ){
98 #ifdef __MINGW32__
99 static const char *zSshCmd = "ssh";
100 #else
101 static const char *zSshCmd = "ssh -e none";
102 #endif
103 char *zCmd;
104 char zIn[20];
 
 
 
105 if( g.urlUser && g.urlUser[0] ){
106 zCmd = mprintf("%s %s@%s", zSshCmd, g.urlUser, g.urlName);
107 }else{
108 zCmd = mprintf("%s %s", zSshCmd, g.urlName);
109 }
110 /* printf("%s\n", zCmd); */
111 popen2(zCmd, &sshIn, &sshOut, &sshPid);
112 if( sshPid==0 ){
113 fossil_fatal("cannot start ssh tunnel using [%s]", zCmd);
114
+1 -1
--- src/popen.c
+++ src/popen.c
@@ -115,11 +115,11 @@
115115
116116
win32_create_child_process((char*)zCmd,
117117
hStdinRd, hStdoutWr, hStderr,&childPid);
118118
*pChildPid = childPid;
119119
*pfdIn = _open_osfhandle(hStdoutRd, 0);
120
- fd = _open_osfhandle(hStdoutWr, 0);
120
+ fd = _open_osfhandle(hStdinWr, 0);
121121
*ppOut = _fdopen(fd, "w");
122122
CloseHandle(hStdinRd);
123123
CloseHandle(hStdoutWr);
124124
return 0;
125125
#else
126126
--- src/popen.c
+++ src/popen.c
@@ -115,11 +115,11 @@
115
116 win32_create_child_process((char*)zCmd,
117 hStdinRd, hStdoutWr, hStderr,&childPid);
118 *pChildPid = childPid;
119 *pfdIn = _open_osfhandle(hStdoutRd, 0);
120 fd = _open_osfhandle(hStdoutWr, 0);
121 *ppOut = _fdopen(fd, "w");
122 CloseHandle(hStdinRd);
123 CloseHandle(hStdoutWr);
124 return 0;
125 #else
126
--- src/popen.c
+++ src/popen.c
@@ -115,11 +115,11 @@
115
116 win32_create_child_process((char*)zCmd,
117 hStdinRd, hStdoutWr, hStderr,&childPid);
118 *pChildPid = childPid;
119 *pfdIn = _open_osfhandle(hStdoutRd, 0);
120 fd = _open_osfhandle(hStdinWr, 0);
121 *ppOut = _fdopen(fd, "w");
122 CloseHandle(hStdinRd);
123 CloseHandle(hStdoutWr);
124 return 0;
125 #else
126

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button