diff options
-rw-r--r-- | archival/dpkg.c | 11 | ||||
-rw-r--r-- | dpkg.c | 11 |
2 files changed, 12 insertions, 10 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c index a97a5a29f..6d3b06a89 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c | |||
@@ -1098,18 +1098,19 @@ int run_package_script(const char *package_name, const char *script_type) | |||
1098 | { | 1098 | { |
1099 | struct stat path_stat; | 1099 | struct stat path_stat; |
1100 | char *script_path; | 1100 | char *script_path; |
1101 | int result; | ||
1101 | 1102 | ||
1102 | script_path = xmalloc(strlen(package_name) + strlen(script_type) + 21); | 1103 | script_path = xmalloc(strlen(package_name) + strlen(script_type) + 21); |
1103 | sprintf(script_path, "/var/lib/dpkg/info/%s.%s", package_name, script_type); | 1104 | sprintf(script_path, "/var/lib/dpkg/info/%s.%s", package_name, script_type); |
1104 | 1105 | ||
1105 | /* If the file doesnt exist is isnt a fatal */ | 1106 | /* If the file doesnt exist is isnt a fatal */ |
1106 | if (lstat(script_path, &path_stat) < 0) { | 1107 | if (lstat(script_path, &path_stat) < 0) { |
1107 | free(script_path); | 1108 | result = EXIT_SUCCESS; |
1108 | return(EXIT_SUCCESS); | ||
1109 | } else { | 1109 | } else { |
1110 | free(script_path); | 1110 | result = system(script_path); |
1111 | return(system(script_path)); | ||
1112 | } | 1111 | } |
1112 | free(script_path); | ||
1113 | return(result); | ||
1113 | } | 1114 | } |
1114 | 1115 | ||
1115 | void all_control_list(char **remove_files, const char *package_name) | 1116 | void all_control_list(char **remove_files, const char *package_name) |
@@ -1298,7 +1299,7 @@ void unpack_package(deb_file_t *deb_file) | |||
1298 | /* Create the list file */ | 1299 | /* Create the list file */ |
1299 | strcat(info_prefix, "list"); | 1300 | strcat(info_prefix, "list"); |
1300 | out_stream = xfopen(info_prefix, "w"); | 1301 | out_stream = xfopen(info_prefix, "w"); |
1301 | deb_extract(deb_file->filename, out_stream, (extract_quiet | extract_data_tar_gz | extract_list), NULL, NULL); | 1302 | deb_extract(deb_file->filename, out_stream, (extract_quiet | extract_data_tar_gz | extract_list), "/", NULL); |
1302 | fclose(out_stream); | 1303 | fclose(out_stream); |
1303 | 1304 | ||
1304 | /* change status */ | 1305 | /* change status */ |
@@ -1098,18 +1098,19 @@ int run_package_script(const char *package_name, const char *script_type) | |||
1098 | { | 1098 | { |
1099 | struct stat path_stat; | 1099 | struct stat path_stat; |
1100 | char *script_path; | 1100 | char *script_path; |
1101 | int result; | ||
1101 | 1102 | ||
1102 | script_path = xmalloc(strlen(package_name) + strlen(script_type) + 21); | 1103 | script_path = xmalloc(strlen(package_name) + strlen(script_type) + 21); |
1103 | sprintf(script_path, "/var/lib/dpkg/info/%s.%s", package_name, script_type); | 1104 | sprintf(script_path, "/var/lib/dpkg/info/%s.%s", package_name, script_type); |
1104 | 1105 | ||
1105 | /* If the file doesnt exist is isnt a fatal */ | 1106 | /* If the file doesnt exist is isnt a fatal */ |
1106 | if (lstat(script_path, &path_stat) < 0) { | 1107 | if (lstat(script_path, &path_stat) < 0) { |
1107 | free(script_path); | 1108 | result = EXIT_SUCCESS; |
1108 | return(EXIT_SUCCESS); | ||
1109 | } else { | 1109 | } else { |
1110 | free(script_path); | 1110 | result = system(script_path); |
1111 | return(system(script_path)); | ||
1112 | } | 1111 | } |
1112 | free(script_path); | ||
1113 | return(result); | ||
1113 | } | 1114 | } |
1114 | 1115 | ||
1115 | void all_control_list(char **remove_files, const char *package_name) | 1116 | void all_control_list(char **remove_files, const char *package_name) |
@@ -1298,7 +1299,7 @@ void unpack_package(deb_file_t *deb_file) | |||
1298 | /* Create the list file */ | 1299 | /* Create the list file */ |
1299 | strcat(info_prefix, "list"); | 1300 | strcat(info_prefix, "list"); |
1300 | out_stream = xfopen(info_prefix, "w"); | 1301 | out_stream = xfopen(info_prefix, "w"); |
1301 | deb_extract(deb_file->filename, out_stream, (extract_quiet | extract_data_tar_gz | extract_list), NULL, NULL); | 1302 | deb_extract(deb_file->filename, out_stream, (extract_quiet | extract_data_tar_gz | extract_list), "/", NULL); |
1302 | fclose(out_stream); | 1303 | fclose(out_stream); |
1303 | 1304 | ||
1304 | /* change status */ | 1305 | /* change status */ |