df: fix "df /"

also, clean up mount checks in mkfs/fsck.

function                                             old     new   delta
find_mount_point                                     243     261     +18
sha1_process_block64                                 497     510     +13
find_main                                            436     444      +8
display_speed                                         85      90      +5
df_main                                              795     793      -2
parse_command                                       1463    1460      -3
static.ignored_mounts                                  8       -      -8
mkfs_minix_main                                     2962    2937     -25
fsck_minix_main                                     3065    2970     -95
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 4/4 up/down: 44/-133)           Total: -89 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2009-07-05 04:50:36 +02:00
parent 9b1b62adc4
commit 09e63bb81f
8 changed files with 46 additions and 53 deletions

View File

@@ -21,7 +21,7 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
/* Check if the file already exists */
if (archive_handle->ah_flags & ARCHIVE_EXTRACT_UNCONDITIONAL) {
/* Remove the entry if it exists */
if (((file_header->mode & S_IFMT) != S_IFDIR)
if ((!S_ISDIR(file_header->mode))
&& (unlink(file_header->name) == -1)
&& (errno != ENOENT)
) {
@@ -132,7 +132,7 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
#endif
lchown(file_header->name, file_header->uid, file_header->gid);
}
if ((file_header->mode & S_IFMT) != S_IFLNK) {
if (S_ISLNK(file_header->mode)) {
/* uclibc has no lchmod, glibc is even stranger -
* it has lchmod which seems to do nothing!
* so we use chmod... */