mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-29 20:54:13 +01:00
Use lstat() instead of stat() for checking if the final source file exists,
so that `ln -fs' works when the source is a symlink pointing to a non- existent file.
This commit is contained in:
parent
024cb43d29
commit
4bd4925bd2
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: ln.c,v 1.4 1994/09/24 02:55:48 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -142,9 +142,9 @@ linkit(target, source, isdir)
|
||||
++p;
|
||||
(void)snprintf(path, sizeof(path), "%s/%s", source, p);
|
||||
source = path;
|
||||
exists = !stat(source, &sb);
|
||||
exists = !lstat(source, &sb);
|
||||
} else
|
||||
exists = !stat(source, &sb);
|
||||
exists = !lstat(source, &sb);
|
||||
|
||||
/*
|
||||
* If the file exists, and -f was specified, unlink it.
|
||||
|
Loading…
Reference in New Issue
Block a user