mirror of https://github.com/ericonr/sndio.git
libsndio: move ~/.aucat_cookie to ~/.sndio/cookie
This commit is contained in:
parent
ea55b2c67d
commit
8018db24a0
|
@ -244,7 +244,8 @@ _aucat_wdata(struct aucat *hdl, const void *buf, size_t len,
|
||||||
static int
|
static int
|
||||||
aucat_mkcookie(unsigned char *cookie)
|
aucat_mkcookie(unsigned char *cookie)
|
||||||
{
|
{
|
||||||
#define COOKIE_SUFFIX "/.aucat_cookie"
|
#define COOKIE_DIR "/.sndio"
|
||||||
|
#define COOKIE_SUFFIX "/.sndio/cookie"
|
||||||
#define TEMPL_SUFFIX ".XXXXXXXX"
|
#define TEMPL_SUFFIX ".XXXXXXXX"
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
char *home, *path = NULL, *tmp = NULL;
|
char *home, *path = NULL, *tmp = NULL;
|
||||||
|
@ -311,11 +312,20 @@ bad_gen:
|
||||||
/*
|
/*
|
||||||
* try to save the cookie
|
* try to save the cookie
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (home == NULL)
|
if (home == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
tmp = malloc(path_len + sizeof(TEMPL_SUFFIX));
|
tmp = malloc(path_len + sizeof(TEMPL_SUFFIX));
|
||||||
if (tmp == NULL)
|
if (tmp == NULL)
|
||||||
goto done;
|
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, path_len);
|
||||||
memcpy(tmp + path_len, TEMPL_SUFFIX, sizeof(TEMPL_SUFFIX));
|
memcpy(tmp + path_len, TEMPL_SUFFIX, sizeof(TEMPL_SUFFIX));
|
||||||
fd = mkstemp(tmp);
|
fd = mkstemp(tmp);
|
||||||
|
|
|
@ -191,7 +191,7 @@ Users are identified by their
|
||||||
which is automatically generated by audio or MIDI applications
|
which is automatically generated by audio or MIDI applications
|
||||||
upon the first connection to the server.
|
upon the first connection to the server.
|
||||||
The cookie is stored in
|
The cookie is stored in
|
||||||
.Pa "$HOME/.aucat_cookie"
|
.Pa "$HOME/.sndio/cookie"
|
||||||
and contains 128 bits of raw random data.
|
and contains 128 bits of raw random data.
|
||||||
.Pp
|
.Pp
|
||||||
If a session needs to be shared between multiple users, they
|
If a session needs to be shared between multiple users, they
|
||||||
|
|
Loading…
Reference in New Issue