Skip to content

Commit

Permalink
Creates directory if it doesnt exist
Browse files Browse the repository at this point in the history
Signed-off-by: GLVS Kiriti <[email protected]>
  • Loading branch information
GLVSKiriti authored and poiana committed Mar 25, 2024
1 parent ecddc6e commit 3a21093
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions events/syscall/write_below_monitored_dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ var _ = events.Register(

func WriteBelowMonitoredDir(h events.Helper) error {
const filename = "/usr/local/bin/created-by-event-generator"

// Create the directory if it doesn't exist
if err := os.MkdirAll("/usr/local/bin", 0755); err != nil {
return err
}

h.Log().Infof("writing to %s", filename)
defer os.Remove(filename)
return os.WriteFile(filename, nil, os.FileMode(0755))
Expand Down

0 comments on commit 3a21093

Please sign in to comment.