Mercurial > go > multipass
comparison multipass-checkpassword.go @ 4:b8545eea86b4
Use proper separator on multipass reads.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sat, 24 Oct 2015 23:16:42 -0400 |
parents | ec4ded022025 |
children | 882f913f4e89 |
comparison
equal
deleted
inserted
replaced
3:ec4ded022025 | 4:b8545eea86b4 |
---|---|
15 ) | 15 ) |
16 | 16 |
17 func main() { | 17 func main() { |
18 infile := os.NewFile(3, "") | 18 infile := os.NewFile(3, "") |
19 reader := bufio.NewReader(os.Stdin) | 19 reader := bufio.NewReader(os.Stdin) |
20 username, err := reader.ReadString('\n') | 20 username, err := reader.ReadString('\0') |
21 if err != nil { | 21 if err != nil { |
22 os.Exit(InternalError) | 22 os.Exit(InternalError) |
23 } | 23 } |
24 username = username[:len(username)-1] | 24 username = username[:len(username)-1] |
25 pass, err := reader.ReadString('\n') | 25 pass, err := reader.ReadString('\0') |
26 if err != nil { | 26 if err != nil { |
27 os.Exit(InternalError) | 27 os.Exit(InternalError) |
28 } | 28 } |
29 pass = pass[:len(pass)-1] | 29 pass = pass[:len(pass)-1] |
30 infile.Close() | 30 infile.Close() |