summaryrefslogtreecommitdiffstats
path: root/src/pulse/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-10-29 15:32:22 +0000
committerLennart Poettering <lennart@poettering.net>2007-10-29 15:32:22 +0000
commit27d6b7b4732f3678ecb6f1e5e53d440f1e8b2547 (patch)
tree1bfa866016cbd172bf92d494ae443f1dffd91fc3 /src/pulse/util.c
parentca98c544ab7a26bfc840d1470f467a7dea06238c (diff)
make use of new pa_readlink() where applicable
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1975 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pulse/util.c')
-rw-r--r--src/pulse/util.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/pulse/util.c b/src/pulse/util.c
index 5dbb670b..d3ac9f66 100644
--- a/src/pulse/util.c
+++ b/src/pulse/util.c
@@ -55,6 +55,7 @@
#include <sys/prctl.h>
#endif
+#include <pulse/xmalloc.h>
#include <pulsecore/winsock.h>
#include <pulsecore/core-error.h>
#include <pulsecore/log.h>
@@ -172,13 +173,13 @@ char *pa_get_binary_name(char *s, size_t l) {
#ifdef __linux__
{
- int i;
- char path[PATH_MAX];
+ char *rp;
/* This works on Linux only */
- if ((i = readlink("/proc/self/exe", path, sizeof(path)-1)) >= 0) {
- path[i] = 0;
- return pa_strlcpy(s, pa_path_get_filename(path), l);
+ if ((rp = pa_readlink("/proc/self/exe"))) {
+ pa_strlcpy(s, pa_path_get_filename(rp), l);
+ pa_xfree(rp);
+ return s;
}
}