From mboxrd@z Thu Jan 1 00:00:00 1970 From: pcaulfield@sourceware.org Date: 31 Jan 2007 11:16:05 -0000 Subject: [Cluster-devel] cluster/dlm/lib libdlm.c Message-ID: <20070131111605.4026.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Branch: RHEL5 Changes by: pcaulfield at sourceware.org 2007-01-31 11:16:05 Modified files: dlm/lib : libdlm.c Log message: Read the LVB every time, rather than not at all. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/dlm/lib/libdlm.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.32&r2=1.32.2.1 --- cluster/dlm/lib/libdlm.c 2006/07/12 07:47:47 1.32 +++ cluster/dlm/lib/libdlm.c 2007/01/31 11:16:04 1.32.2.1 @@ -406,14 +406,14 @@ static int do_dlm_dispatch(int fd) { - struct dlm_lock_result resultbuf; - struct dlm_lock_result *result = &resultbuf; + char resultbuf[sizeof(struct dlm_lock_result) + DLM_USER_LVB_LEN]; + struct dlm_lock_result *result = (struct dlm_lock_result *)resultbuf; char *fullresult = NULL; int status; void (*astaddr)(void *astarg); - /* Just read the header first */ - status = read(fd, result, sizeof(struct dlm_lock_result)); + /* Just read the header & LVB first */ + status = read(fd, result, sizeof(resultbuf)); if (status <= 0) return -1; @@ -433,6 +433,10 @@ if (newstat == result->length) result = (struct dlm_lock_result *)fullresult; } + else + { + fullresult = resultbuf; + } /* Copy lksb to user's buffer - except the LVB ptr */ memcpy(result->user_lksb, &result->lksb, sizeof(struct dlm_lksb) - sizeof(char*)); @@ -468,7 +472,7 @@ astaddr(result->user_astparam); } - if (fullresult) + if (fullresult != resultbuf) free(fullresult); return 0; }