If it isn't possible to determine the realpath() of ".", then simply
give up on attempting to resolve any relative path - there's no hope.
This commit is contained in:
parent
0ca4a2096b
commit
d736f87f8e
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: realpath.c,v 1.2 2022/07/21 09:47:31 kre Exp $ */
|
/* $NetBSD: realpath.c,v 1.3 2023/05/25 17:24:17 kre Exp $ */
|
||||||
/*-
|
/*-
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*
|
*
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
#if 0
|
#if 0
|
||||||
__FBSDID("$FreeBSD: head/bin/realpath/realpath.c 326025 2017-11-20 19:49:47Z pfg $");
|
__FBSDID("$FreeBSD: head/bin/realpath/realpath.c 326025 2017-11-20 19:49:47Z pfg $");
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: realpath.c,v 1.2 2022/07/21 09:47:31 kre Exp $");
|
__RCSID("$NetBSD: realpath.c,v 1.3 2023/05/25 17:24:17 kre Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
|
@ -132,6 +132,10 @@ process(char *path)
|
||||||
|
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
p = realpath(".", buf);
|
p = realpath(".", buf);
|
||||||
|
if (p == NULL) {
|
||||||
|
warnx("relative path; current location unknown");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if ((size_t)snprintf(buf2, sizeof buf2, "%s/%s", buf, path)
|
if ((size_t)snprintf(buf2, sizeof buf2, "%s/%s", buf, path)
|
||||||
>= sizeof buf2) {
|
>= sizeof buf2) {
|
||||||
if (!qflag)
|
if (!qflag)
|
||||||
|
|
Loading…
Reference in New Issue