mirror of
https://github.com/samba-team/samba.git
synced 2025-01-25 06:04:04 +03:00
r7361: fixed the 'file becomes a directory' bug that marc kapland found.
Thanks Marc!
This commit is contained in:
parent
0f2943ac17
commit
d1c5eb3693
@ -68,11 +68,16 @@ NTSTATUS pvfs_match_attrib(struct pvfs_state *pvfs, struct pvfs_filename *name,
|
|||||||
/*
|
/*
|
||||||
normalise a file attribute
|
normalise a file attribute
|
||||||
*/
|
*/
|
||||||
uint32_t pvfs_attrib_normalise(uint32_t attrib)
|
uint32_t pvfs_attrib_normalise(uint32_t attrib, mode_t mode)
|
||||||
{
|
{
|
||||||
if (attrib != FILE_ATTRIBUTE_NORMAL) {
|
if (attrib != FILE_ATTRIBUTE_NORMAL) {
|
||||||
attrib &= ~FILE_ATTRIBUTE_NORMAL;
|
attrib &= ~FILE_ATTRIBUTE_NORMAL;
|
||||||
}
|
}
|
||||||
|
if (S_ISDIR(mode)) {
|
||||||
|
attrib |= FILE_ATTRIBUTE_DIRECTORY;
|
||||||
|
} else {
|
||||||
|
attrib &= ~FILE_ATTRIBUTE_DIRECTORY;
|
||||||
|
}
|
||||||
return attrib;
|
return attrib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +184,8 @@ NTSTATUS pvfs_dosattrib_load(struct pvfs_state *pvfs, struct pvfs_filename *name
|
|||||||
switch (attrib.version) {
|
switch (attrib.version) {
|
||||||
case 1:
|
case 1:
|
||||||
info1 = &attrib.info.info1;
|
info1 = &attrib.info.info1;
|
||||||
name->dos.attrib = pvfs_attrib_normalise(info1->attrib);
|
name->dos.attrib = pvfs_attrib_normalise(info1->attrib,
|
||||||
|
name->st.st_mode);
|
||||||
name->dos.ea_size = info1->ea_size;
|
name->dos.ea_size = info1->ea_size;
|
||||||
if (name->st.st_size == info1->size) {
|
if (name->st.st_size == info1->size) {
|
||||||
name->dos.alloc_size =
|
name->dos.alloc_size =
|
||||||
@ -201,7 +202,8 @@ NTSTATUS pvfs_dosattrib_load(struct pvfs_state *pvfs, struct pvfs_filename *name
|
|||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
info2 = &attrib.info.info2;
|
info2 = &attrib.info.info2;
|
||||||
name->dos.attrib = pvfs_attrib_normalise(info2->attrib);
|
name->dos.attrib = pvfs_attrib_normalise(info2->attrib,
|
||||||
|
name->st.st_mode);
|
||||||
name->dos.ea_size = info2->ea_size;
|
name->dos.ea_size = info2->ea_size;
|
||||||
if (name->st.st_size == info2->size) {
|
if (name->st.st_size == info2->size) {
|
||||||
name->dos.alloc_size =
|
name->dos.alloc_size =
|
||||||
@ -248,7 +250,7 @@ NTSTATUS pvfs_dosattrib_save(struct pvfs_state *pvfs, struct pvfs_filename *name
|
|||||||
attrib.version = 2;
|
attrib.version = 2;
|
||||||
info2 = &attrib.info.info2;
|
info2 = &attrib.info.info2;
|
||||||
|
|
||||||
name->dos.attrib = pvfs_attrib_normalise(name->dos.attrib);
|
name->dos.attrib = pvfs_attrib_normalise(name->dos.attrib, name->st.st_mode);
|
||||||
|
|
||||||
info2->attrib = name->dos.attrib;
|
info2->attrib = name->dos.attrib;
|
||||||
info2->ea_size = name->dos.ea_size;
|
info2->ea_size = name->dos.ea_size;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user