From d9cf7ac781c1274d6d23fa5674b6b90baaf4cf61 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 12 Apr 2006 18:39:58 +0000 Subject: - patch from Denis Vlasenko to add and use bb_xchdir() --- archival/dpkg_deb.c | 18 ++++-------------- archival/tar.c | 7 +++---- archival/unzip.c | 5 ++--- 3 files changed, 9 insertions(+), 21 deletions(-) (limited to 'archival') diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c index fa89e44a0..fc8b9221d 100644 --- a/archival/dpkg_deb.c +++ b/archival/dpkg_deb.c @@ -1,18 +1,8 @@ +/* vi: set sw=4 ts=4: */ /* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * dpkg-deb packs, unpacks and provides information about Debian archives. * + * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ #include #include @@ -100,7 +90,7 @@ int dpkg_deb_main(int argc, char **argv) } if (extract_dir) { mkdir(extract_dir, 0777); - chdir(extract_dir); + chdir(extract_dir); /* error check? */ } unpack_ar_archive(ar_archive); diff --git a/archival/tar.c b/archival/tar.c index 9d0a7c5e4..dcc2f163e 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -19,9 +19,8 @@ * * Based in part on the tar implementation from busybox-0.28 * Copyright (C) 1995 Bruce Perens - * This is free software under the GNU General Public License. * - * Licensed under GPL v2 (or later), see file LICENSE in this tarball. + * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ #include @@ -834,8 +833,8 @@ int tar_main(int argc, char **argv) } } - if ((base_dir) && (chdir(base_dir))) - bb_perror_msg_and_die("Couldnt chdir to %s", base_dir); + if (base_dir) + bb_xchdir(base_dir); /* create an archive */ if (ENABLE_FEATURE_TAR_CREATE && (opt & CTX_CREATE)) { diff --git a/archival/unzip.c b/archival/unzip.c index bb7197d3e..b9dff1985 100644 --- a/archival/unzip.c +++ b/archival/unzip.c @@ -236,9 +236,8 @@ int unzip_main(int argc, char **argv) } /* Change dir if necessary */ - if (base_dir && chdir(base_dir)) { - bb_perror_msg_and_die("Cannot chdir"); - } + if (base_dir) + bb_xchdir(base_dir); if (verbosity != v_silent) printf("Archive: %s\n", src_fn); -- cgit v1.2.3