fsutil

package
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFile

func CreateFile(path string) (*os.File, error)

CreateFile creates a new file, failing if anything already exists at the path. It is equivalent to OpenFile with O_RDWR|O_CREATE|O_EXCL flags and 0600 permissions (owner read/write only).

func OpenFile

func OpenFile(path string, flag int, perm os.FileMode) (*os.File, error)

OpenFile behaves like os.OpenFile, except that:

  1. Any missing parent directories in the path are created implicitly
  2. Ownership of the file (and any created parent directories) are set to match that of the nearest existing ancestor, when OpenFile creates them.

Everything below the nearest existing ancestor is created through handles rather than paths, files are created exclusively, and ownership only changes on what OpenFile created, so a planted symlink or file cannot make OpenFile hand over an existing file, or make CreateFile write to one. Symlinked directories are still followed, so a planted one can change where a new file is created; it still takes the ownership of the nearest existing ancestor.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL