Lines Matching refs:fn
71 /* Load an authentication cookie from file fn and store it in data. If
73 static int load(const char *fn, bool create, void *data, size_t length) {
79 pa_assert(fn);
84 pa_make_secure_parent_dir(fn, pa_in_system_mode() ? 0755U : 0700U, -1, -1, false);
86 if ((fd = pa_open_cloexec(fn, (create ? O_RDWR|O_CREAT : O_RDONLY)|O_BINARY, S_IRUSR|S_IWUSR)) < 0) {
88 if (!create || errno != EACCES || (fd = open(fn, O_RDONLY|O_BINARY)) < 0) {
89 pa_log_warn("Failed to open cookie file '%s': %s", fn, pa_cstrerror(errno));
98 pa_log("Failed to read cookie file '%s': %s", fn, pa_cstrerror(errno));
103 pa_log_debug("Got %d bytes from cookie file '%s', expected %d", (int) r, fn, (int) length);
134 static int normalize_path(const char *fn, char **_r) {
135 pa_assert(fn);
138 if (!pa_is_path_absolute(fn))
139 return pa_append_to_config_home_dir(fn, _r);
141 *_r = pa_xstrdup(fn);
145 int pa_authkey_load(const char *fn, bool create, void *data, size_t length) {
149 pa_assert(fn);
153 if ((ret = normalize_path(fn, &p)) < 0)
165 int pa_authkey_save(const char *fn, const void *data, size_t length) {
171 pa_assert(fn);
175 if ((ret = normalize_path(fn, &p)) < 0)
179 pa_log_warn("Failed to open cookie file '%s': %s", fn, pa_cstrerror(errno));
187 pa_log("Failed to read cookie file '%s': %s", fn, pa_cstrerror(errno));