summaryrefslogtreecommitdiff
path: root/test_utils
diff options
context:
space:
mode:
authorMartin Matuska <martin@matuska.org>2019-04-07 01:54:42 +0200
committerMartin Matuska <martin@matuska.org>2019-04-07 02:38:54 +0200
commit9e1923e84d0803b27ae07e46f0d177cfbc52e0cb (patch)
tree7041c95f63341a5d0e0fc109feeac912e8bd0fd5 /test_utils
parenta221e3445b6a369dc7342ce7a44649e11a1619f0 (diff)
downloadlibarchive-9e1923e84d0803b27ae07e46f0d177cfbc52e0cb.tar.gz
Fix remaining MinGW tests
Enable tests on MinGW CI builds
Diffstat (limited to 'test_utils')
-rw-r--r--test_utils/test_main.c25
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));