mirror of https://github.com/perkeep/perkeep.git
netutil: for better backtraces use named function.
Per feedback on https://camlistore-review.googlesource.com/507 Change-Id: Id6c0e4f66d221e6677167aaf590dc3cc696e5391
This commit is contained in:
parent
f665ca05d3
commit
c5434e293d
|
@ -128,8 +128,10 @@ func (p maybeBrackets) String() string {
|
|||
return s
|
||||
}
|
||||
|
||||
// Store in a var so we can override for testing.
|
||||
var uidFromUsername = func(username string) (uid int, err error) {
|
||||
// Changed by tests.
|
||||
var uidFromUsername = uidFromUsernameFn
|
||||
|
||||
func uidFromUsernameFn(username string) (uid int, err error) {
|
||||
if uid := os.Getuid(); uid != 0 && username == os.Getenv("USER") {
|
||||
return uid, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue