Changeset 84226f0 in mainline


Ignore:
Timestamp:
2011-03-09T15:06:31Z (13 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e2abab03
Parents:
a210bc7
Message:

ext2fs: Check for dot filenames in the other place too

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/ext2fs/ext2fs_ops.c

    ra210bc7 r84226f0  
    7676static void ext2fs_read_file(ipc_callid_t, ipc_callid_t, aoff64_t,
    7777        size_t, ext2fs_instance_t *, ext2_inode_ref_t *);
     78static bool ext2fs_is_dots(const uint8_t *, size_t);
    7879
    7980/*
     
    337338        int rc;
    338339        bool found = false;
     340        size_t name_size;
    339341
    340342        fs = enode->instance->filesystem;
     
    356358        while (it.current != NULL) {
    357359                if (it.current->inode != 0) {
    358                         found = true;
    359                         break;
     360                        name_size = ext2_directory_entry_ll_get_name_length(fs->superblock,
     361                                it.current);
     362                        if (!ext2fs_is_dots(&it.current->name, name_size)) {
     363                                found = true;
     364                                break;
     365                        }
    360366                }
    361367               
     
    625631}
    626632
     633/**
     634 * Determine whether given directory entry name is . or ..
     635 */
     636bool ext2fs_is_dots(const uint8_t *name, size_t name_size) {
     637        if (name_size == 1 && name[0] == '.') {
     638                return true;
     639        }
     640       
     641        if (name_size == 2 && name[0] == '.' && name[1] == '.') {
     642                return true;
     643        }
     644       
     645        return false;
     646}
     647
    627648void ext2fs_read_directory(ipc_callid_t rid, ipc_callid_t callid, aoff64_t pos,
    628649        size_t size, ext2fs_instance_t *inst, ext2_inode_ref_t *inode_ref)
     
    657678               
    658679                // skip . and ..
    659                 if ((name_size == 1 || name_size == 2) && it.current->name == '.') {
    660                         if (name_size == 1) {
    661                                 goto skip;
    662                         }
    663                         else if (name_size == 2 && *(&it.current->name+1) == '.') {
    664                                 goto skip;
    665                         }
     680                if (ext2fs_is_dots(&it.current->name, name_size)) {
     681                        goto skip;
    666682                }
    667683               
Note: See TracChangeset for help on using the changeset viewer.