From owner-p4-projects@FreeBSD.ORG Wed Aug 11 18:26:25 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9E6BB1066BE4; Wed, 11 Aug 2010 18:26:25 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09D2A106694E for ; Wed, 11 Aug 2010 18:26:23 +0000 (UTC) (envelope-from jlaffaye@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 5C6758FC24 for ; Wed, 11 Aug 2010 18:26:22 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o7BIQMiK084541 for ; Wed, 11 Aug 2010 18:26:22 GMT (envelope-from jlaffaye@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o7BIQMOK084538 for perforce@freebsd.org; Wed, 11 Aug 2010 18:26:22 GMT (envelope-from jlaffaye@FreeBSD.org) Date: Wed, 11 Aug 2010 18:26:22 GMT Message-Id: <201008111826.o7BIQMOK084538@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jlaffaye@FreeBSD.org using -f From: Julien Laffaye To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 182218 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Aug 2010 18:26:25 -0000 http://p4web.freebsd.org/@@182218?ac=10 Change 182218 by jlaffaye@jlaffaye-chulak on 2010/08/10 20:04:01 Remove useless globals. Affected files ... .. //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/extract.c#16 edit .. //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/perform.c#15 edit Differences ... ==== //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/extract.c#16 (text+ko) ==== @@ -31,10 +31,8 @@ #include "add.h" -/* Globals used by cleanup() */ -int extract_state; -char db_dir_tmp[FILENAME_MAX]; -char db_dir[FILENAME_MAX]; +/* Global used by cleanup() */ +char db_dir_tmp[FILENAME_MAX]; /* * Extract and parse the plist of a package archive. @@ -90,6 +88,7 @@ Boolean conflictsfound = FALSE; int code = 0; int errcode = 0; + char db_dir[FILENAME_MAX]; char cmd[FILENAME_MAX]; char pre_script[FILENAME_MAX] = INSTALL_FNAME; char post_script[FILENAME_MAX]; @@ -102,7 +101,7 @@ struct stat sb; /* Nothing to cleanup yet */ - extract_state = 0; + db_dir_tmp[0] = '\0'; /* * If we have a prefix, delete the first one we see and add this @@ -289,7 +288,7 @@ printf("%s added successfully\n", p->name); } /* pkg_do() modified this global, so reset it */ - extract_state = 0; + db_dir_tmp[0] = '\0'; } /* XXX: WTF is this logic ? */ else { @@ -324,8 +323,6 @@ warnx("Can not create '%s' directory - aborting", db_dir_tmp); return (1); } - /* Tell cleanup that we have a temporary dir in LOG_DIR */ - extract_state = 1; if (chdir(db_dir_tmp) == -1) { warn("chdir(%s) - aborting", db_dir_tmp); vsystem("%s -rf %s", REMOVE_CMD, db_dir_tmp); @@ -629,7 +626,7 @@ if (rename(db_dir_tmp, db_dir) == -1) warn("Can not rename '%s' to '%s'", db_dir_tmp, db_dir); else { - extract_state = 0; + db_dir_tmp[0] = '\0'; if (Verbose) printf("Package %s registered in %s\n", pkg->name, db_dir); } ==== //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/perform.c#15 (text+ko) ==== @@ -150,6 +150,6 @@ void cleanup(void) { - if (extract_state == 1) + if (db_dir_tmp[0] != '\0') vsystem("%s -rf %s", REMOVE_CMD, db_dir_tmp); }