- patch from Denis Vlasenko to add and use bb_xchdir()

This commit is contained in:
Bernhard Reutner-Fischer
2006-04-12 18:39:58 +00:00
parent 67f641e75b
commit d9cf7ac781
12 changed files with 46 additions and 62 deletions

View File

@@ -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 <fcntl.h>
#include <stdlib.h>
@@ -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);

View File

@@ -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 <fcntl.h>
@@ -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)) {

View File

@@ -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);