veyron/services/store/memstore/state: Fix hard link creation error.
Implicit directory entries have the type refs.Ref, where the ID refers
to the value of the entry.
type Ref struct {
ID storage.ID
Path *Path
Label security.Label
}
The MutableSnapshot had a bug where, if an implicit directory entry
already exists, then replacing the entry with a hard link would store
the link into the existing value, rather than replacing the Ref.ID
field. That could be used to create self-referential values, which cause lots
of problems.
This CL fixes the problem by special-casing the hard-link creation,
independently of whether the value already exists or not.
Change-Id: I2a494c0a1dcd11a6940dcf93360db6f87023f291
2 files changed