Skip to content

Commit b40a2ac

Browse files
committed
govc: fix integer type conversion for guest.chown
Correct the integer type conversion for the `guest.chown`. Signed-off-by: Ryan Johnson <[email protected]>
1 parent 6faf9b2 commit b40a2ac

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cli/vm/guest/chown.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,24 @@ func (cmd *chown) Run(ctx context.Context, f *flag.FlagSet) error {
7474
return flag.ErrHelp
7575
}
7676

77-
id, err := strconv.Atoi(ids[0])
77+
ownerIDStr := ids[0]
78+
ownerID, err := strconv.Atoi(ownerIDStr)
7879
if err != nil {
7980
return err
8081
}
8182

8283
attr.OwnerId = new(int32)
83-
*attr.OwnerId = int32(id)
84+
*attr.OwnerId = int32(ownerID)
8485

8586
if len(ids) == 2 {
86-
id, err = strconv.Atoi(ids[1])
87+
groupIDStr := ids[1]
88+
groupID, err := strconv.Atoi(groupIDStr)
8789
if err != nil {
8890
return err
8991
}
9092

9193
attr.GroupId = new(int32)
92-
*attr.GroupId = int32(id)
94+
*attr.GroupId = int32(groupID)
9395
}
9496

9597
return m.ChangeFileAttributes(ctx, cmd.Auth(), f.Arg(1), &attr)

0 commit comments

Comments
 (0)