Re-add the checks for HAVE_CHFLAGS and HAVE_DBOPEN so that this can build

on systems that don't have either function.
This commit is contained in:
jlam 2003-09-02 01:37:04 +00:00
parent 80fc358b33
commit 1714c64e33
2 changed files with 23 additions and 4 deletions

View file

@ -1,4 +1,4 @@
/* $NetBSD: extract.c,v 1.4 2003/09/01 16:27:11 jlam Exp $ */
/* $NetBSD: extract.c,v 1.5 2003/09/02 01:37:04 jlam Exp $ */
#include <nbcompat.h>
#if HAVE_CONFIG_H
@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "FreeBSD - Id: extract.c,v 1.17 1997/10/08 07:45:35 charnier Exp";
#else
__RCSID("$NetBSD: extract.c,v 1.4 2003/09/01 16:27:11 jlam Exp $");
__RCSID("$NetBSD: extract.c,v 1.5 2003/09/02 01:37:04 jlam Exp $");
#endif
#endif
@ -88,7 +88,9 @@ rollback(char *name, char *home, plist_t *start, plist_t *stop)
if (q->type == PLIST_FILE) {
(void) snprintf(try, sizeof(try), "%s/%s", dir, q->name);
if (make_preserve_name(bup, sizeof(bup), name, try) && fexists(bup)) {
#if HAVE_CHFLAGS
(void) chflags(try, 0);
#endif
(void) unlink(try);
if (rename(bup, try))
warnx("rollback: unable to rename %s back to %s", bup, try);
@ -181,7 +183,9 @@ extract_plist(char *home, package_t *pkg)
/* first try to rename it into place */
(void) snprintf(try, sizeof(try), "%s/%s", Directory, p->name);
if (fexists(try)) {
#if HAVE_CHFLAGS
(void) chflags(try, 0); /* XXX hack - if truly immutable, rename fails */
#endif
if (preserve && PkgName) {
char pf[FILENAME_MAX];

View file

@ -1,4 +1,4 @@
/* $NetBSD: pkgdb.c,v 1.11 2003/09/01 16:27:15 jlam Exp $ */
/* $NetBSD: pkgdb.c,v 1.12 2003/09/02 01:37:05 jlam Exp $ */
#include <nbcompat.h>
#if HAVE_CONFIG_H
@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#endif
#ifndef lint
__RCSID("$NetBSD: pkgdb.c,v 1.11 2003/09/01 16:27:15 jlam Exp $");
__RCSID("$NetBSD: pkgdb.c,v 1.12 2003/09/02 01:37:05 jlam Exp $");
#endif
/*
@ -74,10 +74,13 @@ __RCSID("$NetBSD: pkgdb.c,v 1.11 2003/09/01 16:27:15 jlam Exp $");
/* just in case we change the environment variable name */
#define PKG_DBDIR "PKG_DBDIR"
#if HAVE_DBOPEN
static DB *pkgdbp;
#endif
static char *pkgdb_dir = NULL;
static char pkgdb_cache[FILENAME_MAX];
#if HAVE_DBOPEN
/*
* Open the pkg-database
* Return value:
@ -250,6 +253,18 @@ pkgdb_remove_pkg(const char *pkg)
return ret;
}
#else /* if !HAVE_DBOPEN */
int pkgdb_open(int mode) { return -1; }
void pkgdb_close(void) {}
int pkgdb_store(const char *key, const char *val) { return EXIT_SUCCESS; }
char *pkgdb_retrieve(const char *key) { return NULL; }
void pkgdb_dump(void) {}
int pkgdb_remove(const char *key) { return EXIT_SUCCESS; }
int pkgdb_remove_pkg(const char *pkg) { return EXIT_SUCCESS; }
#endif /* HAVE_DBOPEN */
/*
* Return name of cache file in the buffer that was passed.
*/