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

Commit cedf0cb

Browse files
author
Atin Mukherjee
committed
brick-mux : fix error handling
Fix error handling from ReadFromPidFile call. Also added a check to bypass detach if the brick pid is -1. Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
1 parent 91e5c87 commit cedf0cb

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

glusterd2/brickmux/demultiplex.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,17 @@ func Demultiplex(b brick.Brickinfo) error {
3232
if err != nil {
3333
return err
3434
}
35-
if pidOnFile, err = daemon.ReadPidFromFile(brickDaemon.PidFile()); err == nil {
35+
if pidOnFile, err = daemon.ReadPidFromFile(brickDaemon.PidFile()); err != nil {
3636
log.WithFields(log.Fields{"brick": b.String(),
3737
"pidfile": brickDaemon.PidFile()}).Error("Failed to read the pidfile")
3838
return err
3939

40+
}
41+
if pidOnFile == -1 {
42+
log.WithFields(log.Fields{"brick": b.String(),
43+
"pidfile": brickDaemon.PidFile()}).Error("Pid is -1")
44+
return err
45+
4046
}
4147
brickDaemon.Socketfilepath, err = glusterdGetSockFromBrickPid(pidOnFile)
4248
if err != nil {

0 commit comments

Comments
 (0)