Skip to content

Commit

Permalink
fix tests and add comment head
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Feb 7, 2019
1 parent f008f89 commit 079c2c5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/ssh/ssh.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright 2014 The Gogs Authors. All rights reserved.
// Copyright 2017 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -210,7 +211,7 @@ func GenKeyPair(keyPath string) error {
}

privateKeyPEM := &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(privateKey)}
f, err := os.Create(keyPath)
f, err := os.OpenFile(keyPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
if err != nil {
return err
}
Expand All @@ -227,7 +228,7 @@ func GenKeyPair(keyPath string) error {
}

public := ssh.MarshalAuthorizedKey(pub)
p, err := os.Create(keyPath + ".pub")
p, err := os.OpenFile(keyPath+".pub", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
if err != nil {
return err
}
Expand Down

0 comments on commit 079c2c5

Please sign in to comment.