disk: return the correct ptr from RootPartition
When we iterate over the partitions to find the root partition, we are getting the partition by value so even if we return a pointer to that then, it is actually a pointer duplicated object. Return the pointer to the actual partition object instead.
This commit is contained in:
parent
c8efc7d282
commit
6333d54091
1 changed files with 2 additions and 2 deletions
|
|
@ -107,13 +107,13 @@ func (pt PartitionTable) FSTabStageOptionsV2() *osbuild2.FSTabStageOptions {
|
|||
// a mountpoint) of the partition table. Nil is returned if there's no such
|
||||
// partition.
|
||||
func (pt PartitionTable) RootPartition() *Partition {
|
||||
for _, p := range pt.Partitions {
|
||||
for idx, p := range pt.Partitions {
|
||||
if p.Filesystem == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if p.Filesystem.Mountpoint == "/" {
|
||||
return &p
|
||||
return &pt.Partitions[idx]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue