MCPcopy Create free account
hub / github.com/DataDog/datadog-agent / CreateWithOptions

Method CreateWithOptions

pkg/security/tests/module_tester.go:1496–1512  ·  view source on GitHub ↗
(filename string, user, group, mode int)

Source from the content-addressed store, hash-verified

1494}
1495
1496func (tm *testModule) CreateWithOptions(filename string, user, group, mode int) (string, unsafe.Pointer, error) {
1497 testFile, testFilePtr, err := tm.st.Path(filename)
1498 if err != nil {
1499 return testFile, testFilePtr, err
1500 }
1501
1502 // Create file
1503 f, err := os.OpenFile(testFile, os.O_CREATE, os.FileMode(mode))
1504 if err != nil {
1505 return "", nil, err
1506 }
1507 f.Close()
1508
1509 // Chown the file
1510 err = os.Chown(testFile, user, group)
1511 return testFile, testFilePtr, err
1512}
1513
1514func (tm *testModule) Create(filename string) (string, unsafe.Pointer, error) {
1515 testFile, testPtr, err := tm.st.Path(filename)

Callers 14

TestChmodFunction · 0.80
loadSyscallTesterFunction · 0.80
TestRenameFunction · 0.80
TestProcessMetadataFunction · 0.80
TestUtimesFunction · 0.80
TestChownFunction · 0.80
TestSetXAttrFunction · 0.80
TestRemoveXAttrFunction · 0.80
TestFilterDiscarderMaskFunction · 0.80
TestUnlinkFunction · 0.80
TestChown32Function · 0.80

Calls 2

PathMethod · 0.65
CloseMethod · 0.65

Tested by 13

TestChmodFunction · 0.64
TestRenameFunction · 0.64
TestProcessMetadataFunction · 0.64
TestUtimesFunction · 0.64
TestChownFunction · 0.64
TestSetXAttrFunction · 0.64
TestRemoveXAttrFunction · 0.64
TestFilterDiscarderMaskFunction · 0.64
TestUnlinkFunction · 0.64
TestChown32Function · 0.64
TestOpenMetadataFunction · 0.64