whereis: canonicalize directories paths

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2013-03-20 11:52:35 +01:00
parent 38db00f178
commit f84559ee1c
2 changed files with 7 additions and 5 deletions

View 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

View 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 */