aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
Diffstat (limited to 'archival')
-rw-r--r--archival/dpkg_deb.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c
index fbdb14e26..6653f2a7c 100644
--- a/archival/dpkg_deb.c
+++ b/archival/dpkg_deb.c
@@ -20,7 +20,7 @@
extern int dpkg_deb_main(int argc, char **argv)
{
- char *target_dir = NULL;
+ char *target_dir;
int opt = 0;
int optflag = 0;
@@ -50,9 +50,10 @@ extern int dpkg_deb_main(int argc, char **argv)
}
}
- if (((optind + 1 ) > argc) || (optflag == 0)) {
+ if (optind == argc) {
show_usage();
}
+
switch (optflag) {
case (extract_control):
case (extract_extract):
@@ -60,13 +61,15 @@ extern int dpkg_deb_main(int argc, char **argv)
if ( (optind + 1) == argc ) {
target_dir = (char *) xmalloc(7);
strcpy(target_dir, "DEBIAN");
+ } else {
+ target_dir = (char *) xmalloc(strlen(argv[optind + 1]) + 1);
+ strcpy(target_dir, argv[optind + 1]);
}
break;
- default: {
- target_dir = (char *) xmalloc(strlen(argv[optind + 1]));
- strcpy(target_dir, argv[optind + 1]);
- }
+ default:
+ target_dir = NULL;
}
+
deb_extract(argv[optind], optflag, target_dir);
/* else if (optflag & dpkg_deb_info) {
extract_flag = TRUE;