extract_single_file: reduce indentation

Puts all of the conflict cases at the same level.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
This commit is contained in:
Andrew Gregory 2014-10-01 01:26:33 -04:00 committed by Allan McRae
parent 63660afbc7
commit f917a4a55a
1 changed files with 52 additions and 56 deletions

View File

@ -215,9 +215,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
if(llstat(filename, &lsbuf) != 0) {
/* cases 1,2: file doesn't exist, skip all backup checks */
} else {
if(S_ISDIR(lsbuf.st_mode)) {
if(S_ISDIR(entrymode)) {
} else if(S_ISDIR(lsbuf.st_mode) && S_ISDIR(entrymode)) {
uid_t entryuid = archive_entry_uid(entry);
gid_t entrygid = archive_entry_gid(entry);
@ -248,19 +246,18 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
filename);
archive_read_data_skip(archive);
return 0;
} else {
} else if(S_ISDIR(lsbuf.st_mode)) {
/* case 5: trying to overwrite dir with file, don't allow it */
_alpm_log(handle, ALPM_LOG_ERROR, _("extract: not overwriting dir with file %s\n"),
filename);
archive_read_data_skip(archive);
return 1;
}
} else if(S_ISDIR(entrymode)) {
/* case 4: trying to overwrite file with dir */
_alpm_log(handle, ALPM_LOG_DEBUG, "extract: overwriting file with dir %s\n",
filename);
} else {
/* case 3: */
/* case 3: trying to overwrite file with file */
/* if file is in NoUpgrade, don't touch it */
if(_alpm_fnmatch_patterns(handle->noupgrade, entryname) == 0) {
notouch = 1;
@ -275,7 +272,6 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
}
}
}
}
/* we need access to the original entryname later after calls to
* archive_entry_set_pathname(), so we need to dupe it and free() later */