diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 1995-07-30 01:44:45 +0000 |
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 1995-07-30 01:44:45 +0000 |
| commit | 96d5140413290ed3c5d4e6dccedea1fe44a32595 (patch) | |
| tree | e8a99cae42445cf76c45c227d490494c1ee85532 /usr.sbin/pkg_install/lib/file.c | |
| parent | 573999ad8a6b48e772610c5743d5f6f838bc87d7 (diff) | |
Notes
Diffstat (limited to 'usr.sbin/pkg_install/lib/file.c')
| -rw-r--r-- | usr.sbin/pkg_install/lib/file.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c index 1d578d69d0ef..55ba9d522156 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; |
