Russell Smith wrote:
> *** 1083,1091 ****
> 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");
> set_ps_display(new_status);
>
> awaitedLock = locallock;
> --- 1084,1093 ----
> locallock->lock, locallock->tag.mode);
>
> old_status = pstrdup(get_ps_display());
> ! len = strlen(old_status);
> ! new_status = (char *) palloc(len + 9);
> strcpy(new_status, old_status);
> ! strcpy(&new_status[len], " waiting");
> set_ps_display(new_status);
memcpy(new_status, old_status, len) would be faster yet. Which is what I
originally implemented, and then decided the sprintf() was clearer
(since performance isn't very important here). On reflection, memcpy() +
strcpy() should be fine; I'll commit this tomorrow.
-Neil