Fixed issue with starting sshd in debug mode with a "./" (./sshd.exe -d)
PowerShell/Win32-OpenSSH#1045
This commit is contained in:
parent
df28da5586
commit
fcead5ed76
|
@ -1460,10 +1460,13 @@ int
|
|||
is_absolute_path(char *path)
|
||||
{
|
||||
int retVal = 0;
|
||||
if(*path == '\"') /* skip double quote if path is "c:\abc" */
|
||||
path++;
|
||||
|
||||
if (*path == '/' || *path == '\\' || (*path != '\0' && isalpha(*path) && path[1] == ':') ||
|
||||
((strlen(path) >= strlen(PROGRAM_DATA)) && (memcmp(path, PROGRAM_DATA, strlen(PROGRAM_DATA)) == 0)))
|
||||
retVal = 1;
|
||||
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "inc\fcntl.h"
|
||||
#include "inc\sys\un.h"
|
||||
#include "inc\utf.h"
|
||||
#include "inc\stdio.h"
|
||||
|
||||
#include "w32fd.h"
|
||||
#include "signal_internal.h"
|
||||
|
@ -953,16 +954,14 @@ spawn_child_internal(char* cmd, char *const argv[], HANDLE in, HANDLE out, HANDL
|
|||
int add_module_path = 0, ret = -1;
|
||||
|
||||
/* should module path be added */
|
||||
do {
|
||||
if (!cmd)
|
||||
break;
|
||||
t = cmd;
|
||||
if (*t == '\"')
|
||||
t++;
|
||||
if (t[0] == '\0' || t[0] == '\\' || t[0] == '.' || t[1] == ':')
|
||||
break;
|
||||
if (!cmd) {
|
||||
error("%s invalid argument cmd:%s", __func__, cmd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
t = cmd;
|
||||
if (!is_absolute_path(t))
|
||||
add_module_path = 1;
|
||||
} while (0);
|
||||
|
||||
/* compute total cmdline len*/
|
||||
if (add_module_path)
|
||||
|
|
Loading…
Reference in New Issue