Fossil SCM
Fix a typo in the popen2() implementation for windows. Ticket [cf50ea4d6914fb6d856988da7]. Also refinements on the ssh:// toward getting it working on windows.
Commit
d5c934e5df81f88878f3f9666ac5e96c3081cb9a
Parent
72147afc9df8332…
2 files changed
+7
-5
+1
-1
+7
-5
| --- src/http_transport.c | ||
| +++ src/http_transport.c | ||
| @@ -93,19 +93,21 @@ | ||
| 93 | 93 | /* |
| 94 | 94 | ** Global initialization of the transport layer |
| 95 | 95 | */ |
| 96 | 96 | void transport_global_startup(void){ |
| 97 | 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 | |
| 98 | 103 | char *zCmd; |
| 99 | 104 | char zIn[20]; |
| 100 | -#ifdef __MINGW32__ | |
| 101 | - fossil_fatal("the ssh:// sync method is currently only supported on unix"); | |
| 102 | -#endif | |
| 103 | 105 | 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); | |
| 105 | 107 | }else{ |
| 106 | - zCmd = mprintf("ssh -e none %s", g.urlName); | |
| 108 | + zCmd = mprintf("%s %s", zSshCmd, g.urlName); | |
| 107 | 109 | } |
| 108 | 110 | /* printf("%s\n", zCmd); */ |
| 109 | 111 | popen2(zCmd, &sshIn, &sshOut, &sshPid); |
| 110 | 112 | if( sshPid==0 ){ |
| 111 | 113 | fossil_fatal("cannot start ssh tunnel using [%s]", zCmd); |
| 112 | 114 |
| --- 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 @@ | ||
| 115 | 115 | |
| 116 | 116 | win32_create_child_process((char*)zCmd, |
| 117 | 117 | hStdinRd, hStdoutWr, hStderr,&childPid); |
| 118 | 118 | *pChildPid = childPid; |
| 119 | 119 | *pfdIn = _open_osfhandle(hStdoutRd, 0); |
| 120 | - fd = _open_osfhandle(hStdoutWr, 0); | |
| 120 | + fd = _open_osfhandle(hStdinWr, 0); | |
| 121 | 121 | *ppOut = _fdopen(fd, "w"); |
| 122 | 122 | CloseHandle(hStdinRd); |
| 123 | 123 | CloseHandle(hStdoutWr); |
| 124 | 124 | return 0; |
| 125 | 125 | #else |
| 126 | 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(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 |