From owner-freebsd-bugs@FreeBSD.ORG Mon Nov 5 21:10:02 2007 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 501C216A419 for ; Mon, 5 Nov 2007 21:10:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 2888613C4BD for ; Mon, 5 Nov 2007 21:10:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id lA5LA2In061290 for ; Mon, 5 Nov 2007 21:10:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id lA5LA2Mg061289; Mon, 5 Nov 2007 21:10:02 GMT (envelope-from gnats) Resent-Date: Mon, 5 Nov 2007 21:10:02 GMT Resent-Message-Id: <200711052110.lA5LA2Mg061289@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Beat Gätzi Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43D5516A418 for ; Mon, 5 Nov 2007 21:09:57 +0000 (UTC) (envelope-from beat@chruetertee.ch) Received: from mail11.bluewin.ch (mail11.bluewin.ch [195.186.18.61]) by mx1.freebsd.org (Postfix) with ESMTP id F37E413C481 for ; Mon, 5 Nov 2007 21:09:56 +0000 (UTC) (envelope-from beat@chruetertee.ch) Received: from [83.79.53.151] (83.79.53.151) by mail11.bluewin.ch (Bluewin 7.3.121) id 471B41F20040DA40 for FreeBSD-gnats-submit@freebsd.org; Mon, 5 Nov 2007 21:09:48 +0000 Received: by _HOSTNAME_ (sSMTP sendmail emulation); Mon, 5 Nov 2007 22:09:32 +0100 Message-Id: <471B41F20040DA40@mail11.bluewin.ch> (added by postmaster@bluewin.ch) Date: Mon, 5 Nov 2007 22:09:32 +0100 From: "Beat Gaetzi" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/117855: [patch] pkg_updating: minor code cleanups X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Beat Gätzi List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Nov 2007 21:10:02 -0000 >Number: 117855 >Category: bin >Synopsis: [patch] pkg_updating: minor code cleanups >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Nov 05 21:10:01 UTC 2007 >Closed-Date: >Last-Modified: >Originator: Beat Gätzi >Release: FreeBSD 8.0-CURRENT i386 >Organization: >Environment: System: FreeBSD daedalus.network.local 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Tue Oct 23 22:18:38 CEST 2007 root@daedalus.network.local:/usr/obj/usr/src/sys/GENERIC i386 >Description: - include pkg_install/lib/lib.h - remove stale getopt argument - remove hard coded +CONTENTS file name >How-To-Repeat: >Fix: --- pkg_updating.patch begins here --- diff -Naur src.orig/usr.sbin/pkg_install/lib/lib.h src/usr.sbin/pkg_install/lib/lib.h --- src.orig/usr.sbin/pkg_install/lib/lib.h 2007-10-23 20:38:35.000000000 +0200 +++ src/usr.sbin/pkg_install/lib/lib.h 2007-11-05 21:53:16.000000000 +0100 @@ -57,6 +57,13 @@ /* Usually "rm", but often "echo" during debugging! */ #define RMDIR_CMD "/bin/rmdir" +/* Where the ports lives by default */ +#define DEF_PORTS_DIR "/usr/ports" +/* just in case we change the environment variable name */ +#define PORTSDIR "PORTSDIR" +/* macro to get name of directory where the ports lives */ +#define PORTS_DIR (getenv(PORTSDIR) ? getenv(PORTSDIR) : DEF_PORTS_DIR) + /* Where we put logging information by default, else ${PKG_DBDIR} if set */ #define DEF_LOG_DIR "/var/db/pkg" /* just in case we change the environment variable name */ diff -Naur src.orig/usr.sbin/pkg_install/updating/Makefile src/usr.sbin/pkg_install/updating/Makefile --- src.orig/usr.sbin/pkg_install/updating/Makefile 2007-11-02 23:46:30.000000000 +0100 +++ src/usr.sbin/pkg_install/updating/Makefile 2007-11-04 23:33:27.000000000 +0100 @@ -8,4 +8,7 @@ WARNS?= 6 WFORMAT?= 1 +DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD} +LDADD= ${LIBINSTALL} -lfetch -lmd + .include diff -Naur src.orig/usr.sbin/pkg_install/updating/main.c src/usr.sbin/pkg_install/updating/main.c --- src.orig/usr.sbin/pkg_install/updating/main.c 2007-11-02 23:46:30.000000000 +0100 +++ src/usr.sbin/pkg_install/updating/main.c 2007-11-05 20:19:07.000000000 +0100 @@ -10,18 +10,11 @@ #include __FBSDID("$FreeBSD: src/usr.sbin/pkg_install/updating/main.c,v 1.1 2007/11/02 22:46:30 krion Exp $"); -#include -#include /* For MAXPATHLEN */ - -#include #include #include -#include -#include -#include #include -#include +#include "lib.h" #include "pathnames.h" typedef struct installedport { @@ -81,7 +74,7 @@ DIR *dir; FILE *fd; - while ((ch = getopt(argc, argv, "f:p:d:")) != -1) { + while ((ch = getopt(argc, argv, "f:d:")) != -1) { switch (ch) { case 'd': dflag = 1; @@ -146,7 +139,9 @@ } if(attribute.st_mode & S_IFREG) continue; - (void)strlcat(tmp_file + n, "/+CONTENTS", + (void)strlcat(tmp_file + n, "/", + sizeof(tmp_file) - n); + (void)strlcat(tmp_file + n, CONTENTS_FNAME, sizeof(tmp_file) - n); /* Open +CONTENT file */ @@ -255,3 +250,10 @@ "usage: pkg_updating [-d YYYYMMDD] [-f file] [portname ...]\n"); exit(EX_USAGE); } + +void +cleanup(int sig) +{ + if (sig) + exit(1); +} diff -Naur src.orig/usr.sbin/pkg_install/updating/pathnames.h src/usr.sbin/pkg_install/updating/pathnames.h --- src.orig/usr.sbin/pkg_install/updating/pathnames.h 2007-11-02 23:46:30.000000000 +0100 +++ src/usr.sbin/pkg_install/updating/pathnames.h 2007-11-05 21:53:25.000000000 +0100 @@ -10,19 +10,8 @@ * */ -/* Copy from ../version/version.h */ - -/* Where the ports lives by default */ -#define DEF_PORTS_DIR "/usr/ports/UPDATING" -/* just in case we change the environment variable name */ -#define PORTSDIR "PORTSDIR" -/* macro to get name of directory where we put logging information */ +/* Where the updating file lives by default */ +#define DEF_UPDATING "/usr/ports/UPDATING" +/* macro to define location of the UPDATING file */ #define UPDATING (getenv(PORTSDIR) ? strcat(getenv(PORTSDIR), \ - "/UPDATING") : DEF_PORTS_DIR) - -/* Where we put logging information by default, else ${PKG_DBDIR} if set */ -#define DEF_LOG_DIR "/var/db/pkg" -/* just in case we change the environment variable name */ -#define PKG_DBDIR "PKG_DBDIR" -/* macro to get name of directory where we put logging information */ -#define LOG_DIR (getenv(PKG_DBDIR) ? getenv(PKG_DBDIR) : DEF_LOG_DIR) + "/UPDATING") : DEF_UPDATING) diff -Naur src.orig/usr.sbin/pkg_install/version/version.h src/usr.sbin/pkg_install/version/version.h --- src.orig/usr.sbin/pkg_install/version/version.h 2005-07-27 09:55:12.000000000 +0200 +++ src/usr.sbin/pkg_install/version/version.h 2007-11-05 18:51:56.000000000 +0100 @@ -23,13 +23,6 @@ #ifndef _INST_VERSION_H_INCLUDE #define _INST_VERSION_H_INCLUDE -/* Where the ports lives by default */ -#define DEF_PORTS_DIR "/usr/ports" -/* just in case we change the environment variable name */ -#define PORTSDIR "PORTSDIR" -/* macro to get name of directory where we put logging information */ -#define PORTS_DIR (getenv(PORTSDIR) ? getenv(PORTSDIR) : DEF_PORTS_DIR) - struct index_entry { SLIST_ENTRY(index_entry) next; char *name; --- pkg_updating.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: