mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-08 13:29:59 -05:00
make use of new pa_readlink() where applicable
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1975 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
ca98c544ab
commit
27d6b7b473
2 changed files with 27 additions and 16 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue