libsndio: move ~/.aucat_cookie to ~/.sndio/cookie

This commit is contained in:
Alexandre Ratchov 2018-07-27 15:41:04 +02:00
parent ea55b2c67d
commit 8018db24a0
2 changed files with 12 additions and 2 deletions

View File

@ -244,7 +244,8 @@ _aucat_wdata(struct aucat *hdl, const void *buf, size_t len,
static int
aucat_mkcookie(unsigned char *cookie)
{
#define COOKIE_SUFFIX "/.aucat_cookie"
#define COOKIE_DIR "/.sndio"
#define COOKIE_SUFFIX "/.sndio/cookie"
#define TEMPL_SUFFIX ".XXXXXXXX"
struct stat sb;
char *home, *path = NULL, *tmp = NULL;
@ -311,11 +312,20 @@ bad_gen:
/*
* try to save the cookie
*/
if (home == NULL)
goto done;
tmp = malloc(path_len + sizeof(TEMPL_SUFFIX));
if (tmp == NULL)
goto done;
/* create ~/.sndio directory */
memcpy(tmp, home, home_len);
memcpy(tmp + home_len, COOKIE_DIR, sizeof(COOKIE_DIR));
if (mkdir(tmp, 0755) < 0 && errno != EEXIST)
goto done;
/* create cookie file in it */
memcpy(tmp, path, path_len);
memcpy(tmp + path_len, TEMPL_SUFFIX, sizeof(TEMPL_SUFFIX));
fd = mkstemp(tmp);

View File

@ -191,7 +191,7 @@ Users are identified by their
which is automatically generated by audio or MIDI applications
upon the first connection to the server.
The cookie is stored in
.Pa "$HOME/.aucat_cookie"
.Pa "$HOME/.sndio/cookie"
and contains 128 bits of raw random data.
.Pp
If a session needs to be shared between multiple users, they