pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files/admin Use pkgdb function to...
details: https://anonhg.NetBSD.org/pkgsrc/rev/967bcf3b1b8d
branches: trunk
changeset: 539619:967bcf3b1b8d
user: joerg <joerg%pkgsrc.org@localhost>
date: Sun Mar 09 19:25:16 2008 +0000
description:
Use pkgdb function to compute +CONTENTS name and drop need to play
chdir(2) games. Kill the chdir(2) calls.
diffstat:
pkgtools/pkg_install/files/admin/check.c | 27 +++++++++------------------
1 files changed, 9 insertions(+), 18 deletions(-)
diffs (73 lines):
diff -r 6c5cb0e3bcd9 -r 967bcf3b1b8d pkgtools/pkg_install/files/admin/check.c
--- a/pkgtools/pkg_install/files/admin/check.c Sun Mar 09 19:02:27 2008 +0000
+++ b/pkgtools/pkg_install/files/admin/check.c Sun Mar 09 19:25:16 2008 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: check.c,v 1.1 2008/03/09 19:02:27 joerg Exp $ */
+/* $NetBSD: check.c,v 1.2 2008/03/09 19:25:16 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#endif
#ifndef lint
-__RCSID("$NetBSD: check.c,v 1.1 2008/03/09 19:02:27 joerg Exp $");
+__RCSID("$NetBSD: check.c,v 1.2 2008/03/09 19:25:16 joerg Exp $");
#endif
/*-
@@ -95,10 +95,13 @@
char *PkgName, *dirp = NULL, *md5file;
char file[MaxPathSize];
char dir[MaxPathSize];
+ char *content;
- f = fopen(CONTENTS_FNAME, "r");
+ content = pkgdb_pkg_file(pkgdir, CONTENTS_FNAME);
+ f = fopen(content, "r");
if (f == NULL)
- err(EXIT_FAILURE, "can't open %s/%s/%s", _pkgdb_getPKGDB_DIR(), pkgdir, CONTENTS_FNAME);
+ err(EXIT_FAILURE, "can't open %s", content);
+ free(content);
Plist.head = Plist.tail = NULL;
read_plist(&Plist, f);
@@ -202,19 +205,11 @@
checkpattern_fn(const char *pkg, void *vp)
{
struct checkpattern_arg *arg = vp;
- int rc;
-
- rc = chdir(pkg);
- if (rc == -1)
- err(EXIT_FAILURE, "Cannot chdir to %s/%s", _pkgdb_getPKGDB_DIR(), pkg);
check1pkg(pkg, &arg->filecnt, &arg->pkgcnt);
- if (!quiet) {
+ if (!quiet)
printf(".");
- }
- chdir("..");
-
arg->got_match = 1;
return 0;
@@ -261,16 +256,12 @@
void
check(char **argv)
{
- int filecnt, pkgcnt, rc;
+ int filecnt, pkgcnt;
filecnt = 0;
pkgcnt = 0;
setbuf(stdout, NULL);
- rc = chdir(_pkgdb_getPKGDB_DIR());
- if (rc == -1)
- err(EXIT_FAILURE, "Cannot chdir to %s", _pkgdb_getPKGDB_DIR());
-
if (*argv == NULL) {
check_pkg("*", &filecnt, &pkgcnt, 1);
} else {
Home |
Main Index |
Thread Index |
Old Index