]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
whereis: canonicalize directories paths
authorKarel Zak <kzak@redhat.com>
Wed, 20 Mar 2013 10:52:35 +0000 (11:52 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 20 Mar 2013 10:52:35 +0000 (11:52 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/Makemodule.am
misc-utils/whereis.c

index b77c30aab6e9cb8b02ccec8b6fd5473076d1d32a..a615047f84664ad68bd4d04d2a05c72d4bc75397 100644 (file)
@@ -44,6 +44,7 @@ namei_SOURCES = misc-utils/namei.c lib/strutils.c
 usrbin_exec_PROGRAMS += whereis
 dist_man_MANS += misc-utils/whereis.1
 whereis_SOURCES = misc-utils/whereis.c
+whereis_LDADD = $(LDADD) libcommon.la
 
 if BUILD_LSLOCKS
 usrbin_exec_PROGRAMS += lslocks
index 77d5ed4611891a2f362db0192c18711b55f8653b..ba83b159bdbd0a7b6e5dab9b710c5c46f6e1ea8a 100644 (file)
@@ -53,6 +53,7 @@
 #include "nls.h"
 #include "c.h"
 #include "closestream.h"
+#include "canonicalize.h"
 
 /*#define DEBUG*/
 
@@ -78,16 +79,16 @@ struct wh_dirlist {
 };
 
 static const char *bindirs[] = {
-       "/bin",
        "/usr/bin",
-       "/sbin",
        "/usr/sbin",
+       "/usr/lib",
+       "/usr/lib64",
+       "/bin",
+       "/sbin",
        "/etc",
        "/usr/etc",
        "/lib",
-       "/usr/lib",
        "/lib64",
-       "/usr/lib64",
        "/usr/games",
        "/usr/games/bin",
        "/usr/games/lib",
@@ -209,7 +210,7 @@ static void dirlist_add_dir(struct wh_dirlist **ls0, int type, const char *dir)
        ls->st_ino = st.st_ino;
        ls->st_dev = st.st_dev;
        ls->type = type;
-       ls->path = xstrdup(dir);
+       ls->path = canonicalize_path(dir);
 
        if (!*ls0)
                *ls0 = ls;              /* first in the list */