Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Commit

Permalink
brick-mux : fix error handling
Browse files Browse the repository at this point in the history
Fix error handling from ReadFromPidFile call. Also added a check to
bypass detach if the brick pid is -1.

Signed-off-by: Atin Mukherjee <[email protected]>
  • Loading branch information
Atin Mukherjee committed Jan 10, 2019
1 parent 91e5c87 commit cedf0cb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion glusterd2/brickmux/demultiplex.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,17 @@ func Demultiplex(b brick.Brickinfo) error {
if err != nil {
return err
}
if pidOnFile, err = daemon.ReadPidFromFile(brickDaemon.PidFile()); err == nil {
if pidOnFile, err = daemon.ReadPidFromFile(brickDaemon.PidFile()); err != nil {
log.WithFields(log.Fields{"brick": b.String(),
"pidfile": brickDaemon.PidFile()}).Error("Failed to read the pidfile")
return err

}
if pidOnFile == -1 {
log.WithFields(log.Fields{"brick": b.String(),
"pidfile": brickDaemon.PidFile()}).Error("Pid is -1")
return err

}
brickDaemon.Socketfilepath, err = glusterdGetSockFromBrickPid(pidOnFile)
if err != nil {
Expand Down

0 comments on commit cedf0cb

Please sign in to comment.