mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Cleans up files created if there is a failure.
PiperOrigin-RevId: 206674267 Change-Id: Ifc4eb19e0882e8bed566e9c553af910925fe6ae2
This commit is contained in:
committed by
Shentubot
parent
0a55f8c1c1
commit
543c997978
@@ -392,11 +392,17 @@ func (l *localFile) Create(name string, mode p9.OpenFlags, perm p9.FileMode, uid
|
||||
}
|
||||
if err := fchown(fd, uid, gid); err != nil {
|
||||
syscall.Close(fd)
|
||||
if e := syscall.Unlinkat(l.controlFD(), name); e != nil {
|
||||
log.Warningf("error unlinking file %q after failed chown: %v", name, e)
|
||||
}
|
||||
return nil, nil, p9.QID{}, 0, extractErrno(err)
|
||||
}
|
||||
stat, err := stat(fd)
|
||||
if err != nil {
|
||||
syscall.Close(fd)
|
||||
if e := syscall.Unlinkat(l.controlFD(), name); e != nil {
|
||||
log.Warningf("error unlinking file %q after failed stat: %v", name, e)
|
||||
}
|
||||
return nil, nil, p9.QID{}, 0, extractErrno(err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user