diff --git a/libsndio/aucat.c b/libsndio/aucat.c index a56d5e6..6dd88c4 100644 --- a/libsndio/aucat.c +++ b/libsndio/aucat.c @@ -245,21 +245,17 @@ static int aucat_mkcookie(unsigned char *cookie) { struct stat sb; - char buf[PATH_MAX], tmp[PATH_MAX], *path; + char *home, path[PATH_MAX], tmp[PATH_MAX]; ssize_t len; int fd; /* * try to load the cookie */ - path = issetugid() ? NULL : getenv("AUCAT_COOKIE"); - if (path == NULL) { - path = issetugid() ? NULL : getenv("HOME"); - if (path == NULL) - goto bad_gen; - snprintf(buf, PATH_MAX, "%s/.aucat_cookie", path); - path = buf; - } + home = issetugid() ? NULL : getenv("HOME"); + if (home == NULL) + goto bad_gen; + snprintf(path, PATH_MAX, "%s/.aucat_cookie", home); fd = open(path, O_RDONLY); if (fd < 0) { if (errno != ENOENT) @@ -301,7 +297,7 @@ bad_gen: /* * try to save the cookie */ - if (path == NULL) + if (home == NULL) return 1; if (strlcpy(tmp, path, PATH_MAX) >= PATH_MAX || strlcat(tmp, ".XXXXXXXX", PATH_MAX) >= PATH_MAX) { diff --git a/libsndio/sndio.7 b/libsndio/sndio.7 index 654c820..e5cb53c 100644 --- a/libsndio/sndio.7 +++ b/libsndio/sndio.7 @@ -198,10 +198,6 @@ If a session needs to be shared between multiple users, they can connect to the server using the same cookie. .Sh ENVIRONMENT .Bl -tag -width "AUDIODEVICEXXX" -compact -.It Ev AUCAT_COOKIE -Path to file containing the session cookie to be used -when connecting to -.Xr sndiod 1 . .It Ev AUDIODEVICE Audio device to use if the application provides no device chooser.