From 909e7ff886fb519c878c02fa47955048637cc7e7 Mon Sep 17 00:00:00 2001 From: delphij Date: Thu, 7 Jul 2005 18:10:33 +0000 Subject: Fix a bug when shell expansion is done against dangling symlinks, by converting the stat() call to a lstat() call, which will cover the situation. One can exercise this bug by referring a dangling link with something like */the-link. Approved by: re (scottl) Submitted by: Simon 'corecode' Schubert [corecode fs ei tum de] Obtained from: NetBSD via DragonFlyBSD (NetBSD rev. 1.51 and DragonFly rev. 1.6) MFC After: 3 days --- bin/sh/expand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/sh/expand.c b/bin/sh/expand.c index eccefd0..f087f54 100644 --- a/bin/sh/expand.c +++ b/bin/sh/expand.c @@ -1162,7 +1162,7 @@ expmeta(char *enddir, char *name) if (*p == '\0') break; } - if (metaflag == 0 || stat(expdir, &statb) >= 0) + if (metaflag == 0 || lstat(expdir, &statb) >= 0) addfname(expdir); return; } -- cgit v1.1