Fixed some stupid problems with the stat::st_mode field; the type of

a node was not always correctly determined (or set) - the recent change
of the attribute (directory) modes made these bugs a bit more obtrusive.
This also fixes a drop to the kernel debugger when doing a
"zip -r config.zip config/" in the home directory, as reported by Korli.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12826 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-05-26 08:09:27 +00:00
parent a9d0f0e576
commit 69aaf3f39b
4 changed files with 8 additions and 10 deletions
@@ -1003,7 +1003,7 @@ Inode::CreateAttribute(Transaction &transaction, const char *name, uint32 type,
// Inode::Create() locks the inode for us
return Inode::Create(transaction, attributes, name,
S_ATTR | S_REGULAR | 0666, 0, type, NULL, attribute);
S_ATTR | S_FILE | 0666, 0, type, NULL, attribute);
}
@@ -2244,7 +2244,7 @@ Inode::Create(Transaction &transaction, Inode *parent, const char *name, int32 m
inode->UpdateOldLastModified();
// The "size" & "last_modified" indices don't contain directories
if ((mode & (S_FILE | S_SYMLINK)) != 0) {
if (inode->IsFile() || inode->IsSymLink()) {
// if adding to these indices fails, the inode creation will not be harmed;
// they are considered less important than the "name" index
if (inode->IsFile())
+2 -3
View File
@@ -40,7 +40,6 @@ enum inode_type {
S_FILE = S_IFREG,
S_SYMLINK = S_IFLNK,
S_REGULAR = (S_DIRECTORY | S_FILE | S_SYMLINK),
S_INDEX_TYPES = (S_STR_INDEX | S_INT_INDEX | S_UINT_INDEX | S_LONG_LONG_INDEX
| S_ULONG_LONG_INDEX | S_FLOAT_INDEX | S_DOUBLE_INDEX)
};
@@ -68,11 +67,11 @@ class Inode {
bool IsAttributeDirectory() const { return (Mode() & S_ATTR_DIR) != 0; }
bool IsAttribute() const { return (Mode() & S_ATTR) != 0; }
bool IsFile() const { return S_ISREG(Mode()); }
bool IsFile() const { return (Mode() & (S_IFMT | S_ATTR)) == S_FILE; }
bool IsRegularNode() const { return (Mode() & (S_ATTR_DIR | S_INDEX_DIR | S_ATTR)) == 0; }
// a regular node in the standard namespace (i.e. not an index or attribute)
bool IsSymLink() const { return S_ISLNK(Mode()); }
bool HasUserAccessableStream() const { return S_ISREG(Mode()); }
bool HasUserAccessableStream() const { return IsFile(); }
// currently only files can be accessed with bfs_read()/bfs_write()
bool IsDeleted() const { return (Flags() & INODE_DELETED) != 0; }
@@ -965,7 +965,7 @@ Inode::CreateAttribute(Transaction *transaction, const char *name, uint32 type,
// Inode::Create() locks the inode for us
return Inode::Create(transaction, attributes, name,
S_ATTR | S_REGULAR | 0666, 0, type, NULL, attribute);
S_ATTR | S_FILE | 0666, 0, type, NULL, attribute);
}
@@ -2064,7 +2064,7 @@ Inode::Create(Transaction *transaction, Inode *parent, const char *name, int32 m
inode->UpdateOldLastModified();
// The "size" & "last_modified" indices don't contain directories
if ((mode & (S_FILE | S_SYMLINK)) != 0) {
if (inode->IsFile() || inode->IsSymLink()) {
// if adding to these indices fails, the inode creation will not be harmed;
// they are considered less important than the "name" index
if (inode->IsFile())
@@ -35,7 +35,6 @@ enum inode_type {
S_FILE = S_IFREG,
S_SYMLINK = S_IFLNK,
S_REGULAR = (S_DIRECTORY | S_FILE | S_SYMLINK),
S_INDEX_TYPES = (S_STR_INDEX | S_INT_INDEX | S_UINT_INDEX | S_LONG_LONG_INDEX
| S_ULONG_LONG_INDEX | S_FLOAT_INDEX | S_DOUBLE_INDEX)
};
@@ -101,11 +100,11 @@ class Inode : public CachedBlock {
bool IsAttributeDirectory() const { return (Mode() & S_ATTR_DIR) != 0; }
bool IsAttribute() const { return Mode() & S_ATTR; }
bool IsFile() const { return Mode() & S_IFREG; }
bool IsFile() const { return (Mode() & (S_IFMT | S_ATTR)) == S_FILE; }
bool IsRegularNode() const { return (Mode() & (S_ATTR_DIR | S_INDEX_DIR | S_ATTR)) == 0; }
// a regular node in the standard namespace (i.e. not an index or attribute)
bool IsSymLink() const { return S_ISLNK(Mode()); }
bool HasUserAccessableStream() const { return S_ISREG(Mode()); }
bool HasUserAccessableStream() const { return IsFile(); }
// currently only files can be accessed with bfs_read()/bfs_write()
off_t Size() const { return Node()->data.Size(); }