diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2009-09-14 16:13:12 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2009-09-14 16:13:12 +0000 |
| commit | 3c31e305c095d0d5747681dee4edadc674335e5b (patch) | |
| tree | 6914e7e5900499becc0a8a5f94f33afc729bdc5e /sys/dev/syscons | |
| parent | 8760cb9afb3235c15fe803a191c61ab16cd8e5b2 (diff) | |
Notes
Diffstat (limited to 'sys/dev/syscons')
| -rw-r--r-- | sys/dev/syscons/daemon/daemon_saver.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/dev/syscons/daemon/daemon_saver.c b/sys/dev/syscons/daemon/daemon_saver.c index 3009d31b3583..816795e5a457 100644 --- a/sys/dev/syscons/daemon/daemon_saver.c +++ b/sys/dev/syscons/daemon/daemon_saver.c @@ -351,11 +351,23 @@ daemon_saver(video_adapter_t *adp, int blank) static int daemon_init(video_adapter_t *adp) { + size_t hostlen; mtx_lock(&prison0.pr_mtx); - messagelen = strlen(prison0.pr_hostname) + 3 + strlen(ostype) + 1 + - strlen(osrelease); - message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK); + for (;;) { + hostlen = strlen(prison0.pr_hostname); + mtx_unlock(&prison0.pr_mtx); + + messagelen = hostlen + 3 + strlen(ostype) + 1 + + strlen(osrelease); + message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK); + mtx_lock(&prison0.pr_mtx); + if (hostlen < strlen(prison0.pr_hostname)) { + free(message, M_DEVBUF); + continue; + } + break; + } sprintf(message, "%s - %s %s", prison0.pr_hostname, ostype, osrelease); mtx_unlock(&prison0.pr_mtx); blanked = 0; |
