[pulseaudio-discuss] pa_simple_new function - Failed to load cookie file from cookie: Not a directory

Björn Försterling bjoern.foersterling at web.de
Fri Aug 18 07:05:12 UTC 2023


Hi Sean,

thank you very much for the reply.

I figured out my mistake.
I actually modified the HOME environment variable in my program
by using the pointer that was returned by the getenv() function.
(which is not a pointer to a copy of the string but to the actual env var...)

I wonder why pulseaudio is using these authentication cookies when trying to
connect to a local pulseaudio server though.

Regards
Björn

On Thu, 2023-08-17 at 23:09 -0700, Sean Greenslade wrote:
> On Wed, Aug 16, 2023 at 05:08:25PM +0200, Björn Försterling wrote:
> > Hello everyone,
> > 
> > I am using the pulse audio simple API in a C program and I am getting the
> > following error message when using the "pa_simple_new" function:
> > 
> > 28          simple = pa_simple_new(NULL, "Audio Playback",
> > PA_STREAM_PLAYBACK,
> > NULL, "playback", &ss, NULL, NULL, &pa_error);
> > (gdb) 
> > [New Thread 0x7ffff34416c0 (LWP 3517)]
> > Failed to load cookie file from cookie: Not a directory
> > 
> > The audio file that I am playing in the later part of the program is still
> > being
> > played correctly.
> > But how do I suppress (or solve) this error message?
> > 
> > I tried setting the environment variable PULSE_COOKIE like this:
> > export PULSE_COOKIE="~/.config/pulse/cookie"
> > But it did not help. (this "cookie" file exists)
> > 
> > The return value of the pa_simple_new function is not NULL:
> > (gdb) p simple
> > $1 = (pa_simple *) 0x5555555592d0
> > 
> > And the pa_error integer that I am trying to get an error code with stays at
> > 0.
> > 
> > Can someone please help me to debug this issue?
> 
> The fact that you're getting this exact error message:
> 
> > Failed to load cookie file from cookie: Not a directory
> 
> implies that your environment variable is not getting picked up by your
> application. If you're launching your program from a shell, perhaps try
> directly setting the env var in the calling line, like so:
> 
> $ PULSE_COOKIE=~/.config/pulse/cookie ./my-pulse-using-executable
> 
> --Sean
> 



More information about the pulseaudio-discuss mailing list