summaryrefslogtreecommitdiff
path: root/src/tc-realpath.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tc-realpath.c')
-rw-r--r--src/tc-realpath.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/tc-realpath.c b/src/tc-realpath.c
index 5dd9aa2..23609ca 100644
--- a/src/tc-realpath.c
+++ b/src/tc-realpath.c
@@ -1,16 +1,13 @@
+// SPDX-License-Identifier: MIT
/*
* Test utility for libHX's realpath
- * Copyright Jan Engelhardt
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the WTF Public License version 2 or
- * (at your option) any later version.
*/
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <libHX/io.h>
#include <libHX/option.h>
+#include <libHX/string.h>
static unsigned int rp_flags;
static unsigned int rp_absolute;
@@ -42,6 +39,14 @@ static bool rp_get_options(int *argc, const char ***argv)
return true;
}
+static void t_1(void)
+{
+ hxmc_t *tmp = HXmc_strinit("");
+ /* two components, so that HX_readlink gets called twice */
+ HX_realpath(&tmp, "/dev/tty", HX_REALPATH_DEFAULT);
+ HXmc_free(tmp);
+}
+
int main(int argc, const char **argv)
{
hxmc_t *res;
@@ -49,6 +54,7 @@ int main(int argc, const char **argv)
if (!rp_get_options(&argc, &argv))
return EXIT_FAILURE;
+ t_1();
res = NULL;
while (--argc > 0) {