diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-10-16 13:29:13 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-10-16 13:29:13 +0000 |
commit | aa9eb1fc6718aec0a6a67b2dc748c3416056411e (patch) | |
tree | ec0b7ed85bac6805f10f7a9b2bcfcf7d479e786e | |
parent | 8ef801b40ce0be20ae55676d560d4040c5f1edf0 (diff) | |
download | busybox-w32-aa9eb1fc6718aec0a6a67b2dc748c3416056411e.tar.gz busybox-w32-aa9eb1fc6718aec0a6a67b2dc748c3416056411e.tar.bz2 busybox-w32-aa9eb1fc6718aec0a6a67b2dc748c3416056411e.zip |
rpm: fix incompatibilities which prevented rpm -i foo.src.rpm
function old new delta
fileaction_setowngrp 57 89 +32
-rw-r--r-- | archival/rpm.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/archival/rpm.c b/archival/rpm.c index e1f3c8930..78568687e 100644 --- a/archival/rpm.c +++ b/archival/rpm.c | |||
@@ -202,7 +202,12 @@ static void extract_cpio_gz(int fd) | |||
202 | archive_handle->seek = seek_by_read; | 202 | archive_handle->seek = seek_by_read; |
203 | //archive_handle->action_header = header_list; | 203 | //archive_handle->action_header = header_list; |
204 | archive_handle->action_data = data_extract_all; | 204 | archive_handle->action_data = data_extract_all; |
205 | archive_handle->ah_flags = ARCHIVE_PRESERVE_DATE | ARCHIVE_CREATE_LEADING_DIRS; | 205 | archive_handle->ah_flags = ARCHIVE_PRESERVE_DATE | ARCHIVE_CREATE_LEADING_DIRS |
206 | /* compat: overwrite existing files. | ||
207 | * try "rpm -i foo.src.rpm" few times in a row - | ||
208 | * standard rpm will not complain. | ||
209 | * (TODO? real rpm creates "file;1234" and then renames it) */ | ||
210 | | ARCHIVE_EXTRACT_UNCONDITIONAL; | ||
206 | archive_handle->src_fd = fd; | 211 | archive_handle->src_fd = fd; |
207 | /*archive_handle->offset = 0; - init_handle() did it */ | 212 | /*archive_handle->offset = 0; - init_handle() did it */ |
208 | 213 | ||
@@ -378,9 +383,11 @@ static void fileaction_dobackup(char *filename, int fileref) | |||
378 | 383 | ||
379 | static void fileaction_setowngrp(char *filename, int fileref) | 384 | static void fileaction_setowngrp(char *filename, int fileref) |
380 | { | 385 | { |
381 | int uid, gid; | 386 | /* real rpm warns: "user foo does not exist - using <you>" */ |
382 | uid = xuname2uid(rpm_getstr(TAG_FILEUSERNAME, fileref)); | 387 | struct passwd *pw = getpwnam(rpm_getstr(TAG_FILEUSERNAME, fileref)); |
383 | gid = xgroup2gid(rpm_getstr(TAG_FILEGROUPNAME, fileref)); | 388 | int uid = pw ? pw->pw_uid : getuid(); /* or euid? */ |
389 | struct group *gr = getgrnam(rpm_getstr(TAG_FILEGROUPNAME, fileref)); | ||
390 | int gid = gr ? gr->gr_gid : getgid(); | ||
384 | chown(filename, uid, gid); | 391 | chown(filename, uid, gid); |
385 | } | 392 | } |
386 | 393 | ||