The patbuf[] needs to be filled before print out. Signed-off-by: Sami Kerola <kerolasa@xxxxxx> --- misc-utils/whereis.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/misc-utils/whereis.c b/misc-utils/whereis.c index ba83b15..5339aba 100644 --- a/misc-utils/whereis.c +++ b/misc-utils/whereis.c @@ -408,13 +408,12 @@ static void lookup(const char *pattern, struct wh_dirlist *ls, int want) int count = 0; char *wait = NULL, *p; - DBG(printf("lookup dirs for '%s' (%s)", patbuf, pattern)); - /* canonicalize pattern -- remove path suffix etc. */ p = strrchr(pattern, '/'); p = p ? p + 1 : (char *) pattern; strncpy(patbuf, p, PATH_MAX); patbuf[PATH_MAX - 1] = '\0'; + DBG(printf("lookup dirs for '%s' (%s)", patbuf, pattern)); p = strrchr(patbuf, '.'); if (p) *p = '\0'; -- 2.0.1 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html