mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Internal change.
PiperOrigin-RevId: 234169795 Change-Id: I3c576ae6ad460e2c0e3f142a2671dc18d34a07ef
This commit is contained in:
+8
-6
@@ -207,7 +207,7 @@ func (t *Tattach) handle(cs *connState) message {
|
||||
if err != nil {
|
||||
return newErr(err)
|
||||
}
|
||||
_, valid, attr, err := sf.GetAttr(AttrMaskAll())
|
||||
qid, valid, attr, err := sf.GetAttr(AttrMaskAll())
|
||||
if err != nil {
|
||||
sf.Close() // Drop file.
|
||||
return newErr(err)
|
||||
@@ -231,7 +231,7 @@ func (t *Tattach) handle(cs *connState) message {
|
||||
// Attach the root?
|
||||
if len(t.Auth.AttachName) == 0 {
|
||||
cs.InsertFID(t.FID, root)
|
||||
return &Rattach{}
|
||||
return &Rattach{QID: qid}
|
||||
}
|
||||
|
||||
// We want the same traversal checks to apply on attach, so always
|
||||
@@ -245,7 +245,7 @@ func (t *Tattach) handle(cs *connState) message {
|
||||
|
||||
// Insert the FID.
|
||||
cs.InsertFID(t.FID, newRef)
|
||||
return &Rattach{}
|
||||
return &Rattach{QID: qid}
|
||||
}
|
||||
|
||||
// CanOpen returns whether this file open can be opened, read and written to.
|
||||
@@ -273,12 +273,13 @@ func (t *Tlopen) handle(cs *connState) message {
|
||||
}
|
||||
|
||||
// Are flags valid?
|
||||
if t.Flags&^OpenFlagsModeMask != 0 {
|
||||
flags := t.Flags &^ OpenFlagsIgnoreMask
|
||||
if flags&^OpenFlagsModeMask != 0 {
|
||||
return newErr(syscall.EINVAL)
|
||||
}
|
||||
|
||||
// Is this an attempt to open a directory as writable? Don't accept.
|
||||
if ref.mode.IsDir() && t.Flags != ReadOnly {
|
||||
if ref.mode.IsDir() && flags != ReadOnly {
|
||||
return newErr(syscall.EINVAL)
|
||||
}
|
||||
|
||||
@@ -1083,7 +1084,8 @@ func doWalk(cs *connState, ref *fidRef, names []string) (qids []QID, newRef *fid
|
||||
}); err != nil {
|
||||
return nil, nil, AttrMask{}, Attr{}, err
|
||||
}
|
||||
return qids, newRef, valid, attr, nil
|
||||
// Do not return the new QID.
|
||||
return nil, newRef, valid, attr, nil
|
||||
}
|
||||
|
||||
// Do the walk, one element at a time.
|
||||
|
||||
@@ -41,6 +41,10 @@ const (
|
||||
|
||||
// OpenFlagsModeMask is a mask of valid OpenFlags mode bits.
|
||||
OpenFlagsModeMask OpenFlags = 3
|
||||
|
||||
// OpenFlagsIgnoreMask is a list of OpenFlags mode bits that are ignored for Tlopen.
|
||||
// Note that syscall.O_LARGEFILE is set to zero, use value from Linux fcntl.h.
|
||||
OpenFlagsIgnoreMask OpenFlags = syscall.O_DIRECTORY | 0100000
|
||||
)
|
||||
|
||||
// ConnectFlags is the mode passed to Connect operations.
|
||||
@@ -79,6 +83,8 @@ func (o OpenFlags) String() string {
|
||||
return "ReadWrite"
|
||||
case OpenFlagsModeMask:
|
||||
return "OpenFlagsModeMask"
|
||||
case OpenFlagsIgnoreMask:
|
||||
return "OpenFlagsIgnoreMask"
|
||||
default:
|
||||
return "UNDEFINED"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user