Commit 3be4b5e2 authored by David Fifield's avatar David Fifield
Browse files

Report a Close error in readAuthCookieFile.

parent c538911e
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -616,12 +616,17 @@ func readAuthCookie(f io.Reader) ([]byte, error) {

// Read and validate the contents of an auth cookie file. Returns the 32-byte
// cookie. See section 4.2.1.2 of 217-ext-orport-auth.txt.
func readAuthCookieFile(filename string) ([]byte, error) {
func readAuthCookieFile(filename string) (cookie []byte, err error) {
	f, err := os.Open(filename)
	if err != nil {
		return nil, err
	}
	defer f.Close()
	defer func() {
		closeErr := f.Close()
		if err == nil {
			err = closeErr
		}
	}()

	return readAuthCookie(f)
}