summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pkg_install
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1995-07-30 01:44:45 +0000
committerache <ache@FreeBSD.org>1995-07-30 01:44:45 +0000
commit38976345b1c66dbcf2a2429f10343ea33d7a58df (patch)
treee8a99cae42445cf76c45c227d490494c1ee85532 /usr.sbin/pkg_install
parent438e99a58f566ffa7794ca9aa4e847451eb525df (diff)
downloadFreeBSD-src-38976345b1c66dbcf2a2429f10343ea33d7a58df.zip
FreeBSD-src-38976345b1c66dbcf2a2429f10343ea33d7a58df.tar.gz
You can run pkg_info everywhere expect /var/db/pkg directory :-)
Running there you got any kind of strange errors from tar caused by treating directories as tar files! Fix it by adding new isfile(name) (check for reg. files) to simple fexists(name) calls.
Diffstat (limited to 'usr.sbin/pkg_install')
-rw-r--r--usr.sbin/pkg_install/info/perform.c4
-rw-r--r--usr.sbin/pkg_install/lib/file.c15
-rw-r--r--usr.sbin/pkg_install/lib/lib.h3
3 files changed, 16 insertions, 6 deletions
diff --git a/usr.sbin/pkg_install/info/perform.c b/usr.sbin/pkg_install/info/perform.c
index 9a93253..e09abad 100644
--- a/usr.sbin/pkg_install/info/perform.c
+++ b/usr.sbin/pkg_install/info/perform.c
@@ -1,5 +1,5 @@
#ifndef lint
-static const char *rcsid = "$Id: perform.c,v 1.15 1995/05/10 23:00:06 jkh Exp $";
+static const char *rcsid = "$Id: perform.c,v 1.16 1995/05/30 03:49:59 rgrimes Exp $";
#endif
/*
@@ -91,7 +91,7 @@ pkg_do(char *pkg)
isTMP = TRUE;
}
}
- else if (fexists(pkg)) {
+ else if (fexists(pkg) && isfile(pkg)) {
int len;
if (*pkg != '/') {
diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c
index 1d578d6..55ba9d5 100644
--- a/usr.sbin/pkg_install/lib/file.c
+++ b/usr.sbin/pkg_install/lib/file.c
@@ -1,5 +1,5 @@
#ifndef lint
-static const char *rcsid = "$Id: file.c,v 1.10 1995/05/30 03:50:05 rgrimes Exp $";
+static const char *rcsid = "$Id: file.c,v 1.11 1995/06/24 10:12:59 asami Exp $";
#endif
/*
@@ -71,6 +71,15 @@ isemptydir(char *fname)
return FALSE;
}
+Boolean
+isfile(char *fname)
+{
+ struct stat sb;
+ if (stat(fname, &sb) != FAIL && S_ISREG(sb.st_mode))
+ return TRUE;
+ return FALSE;
+}
+
/* Check to see if file is a file and is empty. If nonexistent or not
a file, say "it's empty", otherwise return TRUE if zero sized. */
Boolean
@@ -256,7 +265,7 @@ fileFindByPath(char *fname)
static char tmp[FILENAME_MAX];
char *cp;
- if (fexists(fname)) {
+ if (fexists(fname) && isfile(fname)) {
strcpy(tmp, fname);
return tmp;
}
@@ -265,7 +274,7 @@ fileFindByPath(char *fname)
char *cp2 = strsep(&cp, ":");
snprintf(tmp, FILENAME_MAX, "%s/%s.tgz", cp2 ? cp2 : cp, fname);
- if (fexists(tmp))
+ if (fexists(tmp) && isfile(fname))
return tmp;
}
return NULL;
diff --git a/usr.sbin/pkg_install/lib/lib.h b/usr.sbin/pkg_install/lib/lib.h
index 61be709..4f80cee 100644
--- a/usr.sbin/pkg_install/lib/lib.h
+++ b/usr.sbin/pkg_install/lib/lib.h
@@ -1,4 +1,4 @@
-/* $Id: lib.h,v 1.15 1995/04/22 13:58:43 jkh Exp $ */
+/* $Id: lib.h,v 1.16 1995/04/26 15:08:22 jkh Exp $ */
/*
* FreeBSD install - a package for the installation and maintainance
@@ -122,6 +122,7 @@ char *basename_of(char *);
/* File */
Boolean fexists(char *);
Boolean isdir(char *);
+Boolean isfile(char *);
Boolean isempty(char *);
Boolean isURL(char *);
char *fileGetURL(char *);
OpenPOWER on IntegriCloud