From 658cbab38fd31894a76a6a4524639adaf60f845d Mon Sep 17 00:00:00 2001 From: sobomax Date: Thu, 11 Oct 2001 11:29:12 +0000 Subject: Make `-t' flag in pkg_*(1) tools actually working. PR: 30843 Submitted by: Vladimir B. Grebenschikov MFC after: 2 weeks --- usr.sbin/pkg_install/lib/pen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'usr.sbin') diff --git a/usr.sbin/pkg_install/lib/pen.c b/usr.sbin/pkg_install/lib/pen.c index f80763c..322067d 100644 --- a/usr.sbin/pkg_install/lib/pen.c +++ b/usr.sbin/pkg_install/lib/pen.c @@ -25,6 +25,7 @@ static const char rcsid[] = #include "lib.h" #include +#include #include #include #include @@ -46,7 +47,7 @@ find_play_pen(char *pen, off_t sz) char *cp; struct stat sb; - if (pen[0] && stat(pen, &sb) != FAIL && (min_free(pen) >= sz)) + if (pen[0] && !fexists(pen) == FAIL && (min_free(dirname(pen)) >= sz)) return pen; else if ((cp = getenv("PKG_TMPDIR")) != NULL && stat(cp, &sb) != FAIL && (min_free(cp) >= sz)) sprintf(pen, "%s/instmp.XXXXXX", cp); -- cgit v1.1