Cleanup and make a safer code (#5794)

This commit is contained in:
Harshavardhana
2018-04-21 20:51:53 -07:00
committed by kannappanr
parent 76cc65531c
commit 954142a98f
5 changed files with 27 additions and 18 deletions

View File

@@ -102,7 +102,14 @@ func (s *adminCmd) ListLocks(query *ListLocksQuery, reply *ListLocksReply) error
if err := query.IsAuthenticated(); err != nil {
return err
}
volLocks := listLocksInfo(query.Bucket, query.Prefix, query.Duration)
objectAPI := newObjectLayerFn()
if objectAPI == nil {
return errServerNotInitialized
}
volLocks, err := objectAPI.ListLocks(context.Background(), query.Bucket, query.Prefix, query.Duration)
if err != nil {
return err
}
*reply = ListLocksReply{VolLocks: volLocks}
return nil
}