PERFORCE change 182645 for review
David Forsythe
dforsyth at FreeBSD.org
Fri Aug 20 07:35:10 UTC 2010
http://p4web.freebsd.org/@@182645?ac=10
Change 182645 by dforsyth at skunk on 2010/08/20 07:34:42
A few of the changes Tim suggested. This is the main libpkg repository now.
Affected files ...
.. //depot/projects/soc2010/dforsyth_libpkg/doc/man/pkg_database.3#1 add
.. //depot/projects/soc2010/dforsyth_libpkg/doc/man/pkg_freebsd.3#1 add
.. //depot/projects/soc2010/dforsyth_libpkg/doc/man/pkg_repository.3#1 add
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/Makefile#3 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/base.h#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/database.c#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/database.h#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/database_internal.h#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/exec.c#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/exec.h#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/exec_internal.h#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_database_directorydb.c#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_database_directorydb.h#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_plist.c#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_plist.h#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_repository_ftp.c#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_repository_ftp.h#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_repository_path.c#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_repository_path.h#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/internal.h#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/logger.c#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/logger.h#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg.c#3 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg.h#3 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_freebsd.c#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_freebsd.h#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_internal.h#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_pkg.h#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/property.c#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/property.h#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/repository.c#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/repository.h#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/repository_internal.h#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/util.c#2 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/util.h#2 edit
Differences ...
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/Makefile#3 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/base.h#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/database.c#2 (text+ko) ====
@@ -49,17 +49,20 @@
}
/* Release a package database from memory. */
-void
+int
pkg_database_release(struct pkg_database *db)
{
_pkg_database_check_magic(db, __func__);
if (db->status != CLOSED) {
- warnx("closing pkg_database before free()");
- db->vtable->close(db);
+ if (db->vtable->close(db) != PKG_OK) {
+ warnx("db->vtable->close() failed.");
+ return (PKG_NOT_OK);
+ }
}
+ free(db);
- free(db);
+ return (PKG_OK);
}
void
@@ -169,8 +172,7 @@
_pkg_check_magic(p, __func__);
if (db->status != OPEN) {
- /* Just leave. */
- return (PKG_NOT_OK);
+ PKG_CLIENT_CRASH(__func__, "db->status != OPEN");
}
/* Log this action. */
/*
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/database.h#2 (text+ko) ====
@@ -15,7 +15,9 @@
struct pkg_database *pkg_database_create(void);
-void pkg_database_release(struct pkg_database *);
+int pkg_database_release(struct pkg_database *);
+
+uid_t pkg_database_owner(struct pkg_database *);
/* Get the next package in a database. */
int pkg_database_get_next_pkg(struct pkg_database *, struct pkg *, u_int);
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/database_internal.h#2 (text+ko) ====
@@ -16,6 +16,7 @@
int (*get_pkg) (struct pkg_database *, struct pkg *, u_int);
int (*rewind) (struct pkg_database *);
int (*open) (struct pkg_database *, const char *, u_int);
+ uid_t (*owner) (struct pkg_database *);
};
/* Define the package database type. */
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/exec.c#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/exec.h#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/exec_internal.h#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_database_directorydb.c#2 (text+ko) ====
@@ -26,6 +26,7 @@
static int _write_pkg(struct pkg_database *, struct pkg *, u_int);
static int _pkg_database_directorydb_open(struct pkg_database *, const char *,
u_int);
+static uid_t _pkg_database_directorydb_owner(struct pkg_database *);
static int _pkg_database_directorydb_rewind(struct pkg_database *);
static int _pkg_database_directorydb_close(struct pkg_database *);
static int _pkg_database_directorydb_add_pkg(struct pkg_database *,
@@ -41,7 +42,8 @@
.add_pkg = _pkg_database_directorydb_add_pkg,
.remove_pkg = _pkg_database_directorydb_remove_pkg,
.rewind = _pkg_database_directorydb_rewind,
- .get_next_pkg = _pkg_database_directorydb_get_next_pkg
+ .get_next_pkg = _pkg_database_directorydb_get_next_pkg,
+ .owner = _pkg_database_directorydb_owner
};
@@ -74,6 +76,20 @@
return ("directorydb");
}
+static uid_t
+_pkg_database_directorydb_owner(struct pkg_database *db)
+{
+ struct _directorydb *d;
+ struct stat sb;
+
+ d = db->internal;
+ if (d == NULL || lstat(d->location[0], &sb) < 0) {
+ return (-1);
+ }
+
+ return (sb.st_uid);
+}
+
static int
_pkg_database_directorydb_open(struct pkg_database *db, const char *path,
u_int flags)
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_database_directorydb.h#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_plist.c#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_plist.h#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_repository_ftp.c#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_repository_ftp.h#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_repository_path.c#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_repository_path.h#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/internal.h#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/logger.c#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/logger.h#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg.c#3 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg.h#3 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_freebsd.c#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_freebsd.h#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_internal.h#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_pkg.h#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/property.c#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/property.h#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/repository.c#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/repository.h#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/repository_internal.h#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/util.c#2 (text+ko) ====
==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/util.h#2 (text+ko) ====
More information about the p4-projects
mailing list