diff options
Diffstat (limited to 'test_utils/test_main.c')
-rw-r--r-- | test_utils/test_main.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/test_utils/test_main.c b/test_utils/test_main.c index 91effdf5..cd4c772b 100644 --- a/test_utils/test_main.c +++ b/test_utils/test_main.c @@ -1717,16 +1717,30 @@ is_symlink(const char *file, int line, REPARSE_DATA_BUFFER *buf; size_t len, len2; wchar_t *linknamew, *contentsw; + const char *p; + char *s, *pn; int ret = 0; BYTE *indata; DWORD flag = FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT; - if (contents == NULL) - return (0); + /* Replace slashes with backslashes in pathname */ + pn = malloc((strlen(pathname) + 1) * sizeof(char)); + p = pathname; + s = pn; + while(*p != '\0') { + if(*p == '/') + *s = '\\'; + else + *s = *p; + p++; + s++; + } + *s = '\0'; - h = CreateFileA(pathname, 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, + h = CreateFileA(pn, 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, flag, NULL); + free(pn); if (h == INVALID_HANDLE_VALUE) return (0); @@ -1747,6 +1761,11 @@ is_symlink(const char *file, int line, return (0); } + if (contents == NULL) { + free(indata); + return (1); + } + len = buf->SymbolicLinkReparseBuffer.SubstituteNameLength; linknamew = malloc(len + sizeof(wchar_t)); |