summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLaMont Jones <lamont@debian.org>2010-10-25 13:42:20 -0600
committerLaMont Jones <lamont@debian.org>2010-10-25 13:42:20 -0600
commitccc5ad27923c600ee5dcab01e6fcc48b5bf82648 (patch)
tree601c20ec4f851abc101ce9d821a4fe74e5283790 /lib
parente61e0ca7d872870ca843133c4c60c6b8992d7bca (diff)
parent973d9cf9c6092d94a3e5b54e5b8e7cd4e2d705d7 (diff)
downloadutil-linux-old-ccc5ad27923c600ee5dcab01e6fcc48b5bf82648.tar.gz
Merge remote branch 'origin/master'
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am3
-rw-r--r--lib/canonicalize.c14
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 2a185f34..45d319d3 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -3,7 +3,7 @@ include $(top_srcdir)/config/include-Makefile.am
AM_CPPFLAGS += -DTEST_PROGRAM
noinst_PROGRAMS = test_blkdev test_ismounted test_wholedisk test_mangle \
- test_strtosize test_tt
+ test_strtosize test_tt test_canonicalize
if LINUX
if HAVE_CPU_SET_T
noinst_PROGRAMS += test_cpuset
@@ -19,6 +19,7 @@ if LINUX
test_cpuset_SOURCES = cpuset.c
endif
test_tt_SOURCES = tt.c
+test_canonicalize_SOURCES = canonicalize.c
if LINUX
test_blkdev_SOURCES += linux_version.c
diff --git a/lib/canonicalize.c b/lib/canonicalize.c
index 29b3f259..1449851f 100644
--- a/lib/canonicalize.c
+++ b/lib/canonicalize.c
@@ -189,3 +189,17 @@ canonicalize_path(const char *path)
}
+#ifdef TEST_PROGRAM
+int main(int argc, char **argv)
+{
+ if (argc < 2) {
+ fprintf(stderr, "usage: %s <device>\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
+ fprintf(stdout, "orig: %s\n", argv[1]);
+ fprintf(stdout, "real: %s\n", canonicalize_path(argv[1]));
+
+ exit(EXIT_SUCCESS);
+}
+#endif