diff options
Diffstat (limited to 'src/backend/storage')
-rw-r--r-- | src/backend/storage/lmgr/lock.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c index 4551443964d..0b611b75a51 100644 --- a/src/backend/storage/lmgr/lock.c +++ b/src/backend/storage/lmgr/lock.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.145.4.1 2005/03/01 21:15:10 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.145.4.2 2005/11/05 03:05:04 tgl Exp $ * * NOTES * Outside modules can create a lock table and acquire/release @@ -1074,19 +1074,21 @@ WaitOnLock(LOCKMETHODID lockmethodid, LOCALLOCK *locallock, ResourceOwner owner) { LockMethod lockMethodTable = LockMethods[lockmethodid]; - char *new_status, - *old_status; + const char *old_status; + char *new_status; + int len; Assert(lockmethodid < NumLockMethods); LOCK_PRINT("WaitOnLock: sleeping on lock", locallock->lock, locallock->tag.mode); - old_status = pstrdup(get_ps_display()); - new_status = (char *) palloc(strlen(old_status) + 10); - strcpy(new_status, old_status); - strcat(new_status, " waiting"); + old_status = get_ps_display(&len); + new_status = (char *) palloc(len + 8 + 1); + memcpy(new_status, old_status, len); + strcpy(new_status + len, " waiting"); set_ps_display(new_status); + new_status[len] = '\0'; /* truncate off " waiting" */ awaitedLock = locallock; awaitedOwner = owner; @@ -1129,8 +1131,7 @@ WaitOnLock(LOCKMETHODID lockmethodid, LOCALLOCK *locallock, awaitedLock = NULL; - set_ps_display(old_status); - pfree(old_status); + set_ps_display(new_status); pfree(new_status); LOCK_PRINT("WaitOnLock: wakeup on lock", |