core-util: replace remaining fixed size destination string functions by _malloc() versions

This helps portability to GNU/Hurd.

Patch originally from Samuel Thibault but modified.

Closes ticket #546
This commit is contained in:
Lennart Poettering 2009-08-01 02:03:22 +02:00
parent c6ea9fecc9
commit 49fd8ee72e
7 changed files with 119 additions and 38 deletions

View file

@ -53,6 +53,7 @@
#include <pulse/pulseaudio.h>
#include <pulse/gccmacro.h>
#include <pulsecore/llist.h>
#include <pulsecore/core-util.h>
/* On some systems SIOCINQ isn't defined, but FIONREAD is just an alias */
#if !defined(SIOCINQ) && defined(FIONREAD)
@ -459,15 +460,16 @@ static void reset_params(fd_info *i) {
}
static const char *client_name(char *buf, size_t n) {
char p[PATH_MAX];
char *p;
const char *e;
if ((e = getenv("PADSP_CLIENT_NAME")))
return e;
if (pa_get_binary_name(p, sizeof(p)))
if ((p = pa_get_binary_name_malloc())) {
snprintf(buf, n, "OSS Emulation[%s]", p);
else
pa_xfree(p);
} else
snprintf(buf, n, "OSS");
return buf;