Skip to content

Commit

Permalink
int overflow safe
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Alpar <[email protected]>
  • Loading branch information
aaron-kasten committed Jan 17, 2025
1 parent 9f0e874 commit 8a62402
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions pkg/kando/process_client_signal.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ func runProcessClientSignal(cmd *cobra.Command, args []string) error {
}

func runProcessClientSignalWithOutput(out io.Writer, cmd *cobra.Command, args []string) error {
pid, err := strconv.Atoi(args[0])
pid, err := strconv.ParseInt(args[0], 0, 64)
if err != nil {
return err
}
signal, err := strconv.Atoi(args[1])
signal, err := strconv.ParseInt(args[1], 0, 64)
if err != nil {
return err
}
Expand All @@ -54,7 +54,7 @@ func runProcessClientSignalWithOutput(out io.Writer, cmd *cobra.Command, args []
}
asJSON := processAsJSONFlagValue(cmd)
cmd.SilenceUsage = true
p, err := kanx.SignalProcess(cmd.Context(), addr, int64(pid), int32(signal))
p, err := kanx.SignalProcess(cmd.Context(), addr, pid, signal)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/kanx/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func ListProcesses(ctx context.Context, addr string) ([]*Process, error) {
}
}

func SignalProcess(ctx context.Context, addr string, pid int64, signal int32) (*Process, error) {
func SignalProcess(ctx context.Context, addr string, pid int64, signal int64) (*Process, error) {
conn, err := newGRPCConnection(addr)
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions pkg/kanx/kanx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/kanx/kanx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ message ProcessPidRequest {

message SignalProcessRequest {
int64 pid = 1;
int32 signal = 2;
int64 signal = 2;
}

message Process {
Expand Down

0 comments on commit 8a62402

Please sign in to comment.