summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/pkg_install/lib/pen.c3
1 files changed, 2 insertions, 1 deletions
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 <err.h>
+#include <libgen.h>
#include <sys/signal.h>
#include <sys/param.h>
#include <sys/mount.h>
@@ -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);
OpenPOWER on IntegriCloud