mirror of
https://github.com/moby/moby.git
synced 2026-08-03 22:51:03 +00:00
pkg/pidfile: pkg/pidfile: use strconv instead of fmt.Sprintf(), and unconvert
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -36,10 +36,10 @@ func New(path string) (*PIDFile, error) {
|
||||
return nil, err
|
||||
}
|
||||
// Note MkdirAll returns nil if a directory already exists
|
||||
if err := system.MkdirAll(filepath.Dir(path), os.FileMode(0755)); err != nil {
|
||||
if err := system.MkdirAll(filepath.Dir(path), 0o755); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := os.WriteFile(path, []byte(fmt.Sprintf("%d", os.Getpid())), 0644); err != nil {
|
||||
if err := os.WriteFile(path, []byte(strconv.Itoa(os.Getpid())), 0o644); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user