From 21101ea0bfdf186e4946e7a25ad6484e51072713 Mon Sep 17 00:00:00 2001 From: David Teigland Date: May 09 2011 21:37:12 +0000 Subject: sanlock: fix inquire of dead pid return an error if the pid is dead by the time we get to process the inquire --- diff --git a/src/main.c b/src/main.c index c0b36d8..911379a 100644 --- a/src/main.c +++ b/src/main.c @@ -1192,7 +1192,7 @@ static void cmd_inquire(struct cmd_args *ca) struct sm_header h; struct token *token; struct client *cl; - char *state, *str; + char *state = NULL, *str; int state_maxlen = 0, state_strlen = 0; int res_count = 0, cat_count = 0; int fd, i, rv, pid_dead; @@ -1209,6 +1209,11 @@ static void cmd_inquire(struct cmd_args *ca) pthread_mutex_lock(&cl->mutex); + if (cl->pid_dead) { + result = -ESTALE; + goto done; + } + for (i = 0; i < SANLK_MAX_RESOURCES; i++) { if (cl->tokens[i]) res_count++;