struct sockaddr_storage from;
fr_bio_fd_packet_ctx_t *addr = fr_bio_fd_packet_ctx(my, packet_ctx);
+#ifdef STATIC_ANALYZER
+ from.af = AF_UNSPEC;
+#endif
+
my->info.read_blocked = false;
memset(&my->cbuf, 0, sizeof(my->cbuf));
mode_t perm;
int parent_fd, fd;
char const *path = cfg->path;
- char *dir, *p;
+ char *p, *dir = NULL;
char *slashes[2];
perm = S_IREAD | S_IWRITE | S_IEXEC;
if (fstat(*dirfd, &buf) < 0) {
fr_strerror_printf("Failed reading parent directory for file %s: %s", path, fr_syserror(errno));
+ fail:
+ talloc_free(dir);
close(*dirfd);
return -1;
}
if (buf.st_uid != cfg->uid) {
fr_strerror_printf("Failed reading parent directory for file %s: Incorrect UID", path);
- return -1;
+ goto fail;
}
if (buf.st_gid != cfg->gid) {
fr_strerror_printf("Failed reading parent directory for file %s: Incorrect GID", path);
- return -1;
+ goto fail;
}
/*
*/
if (fchmod(*dirfd, perm) < 0) {
fr_strerror_printf("Failed setting parent directory permissions for file %s: %s", path, fr_syserror(errno));
- close(*dirfd);
- return -1;
+ goto fail;
}
return 0;
}
dir = talloc_strdup(NULL, path);
- if (!dir) return -1;
+ if (!dir) goto fail;
/*
* Find the last two directory separators.
*/
if (!slashes[0]) {
fr_strerror_printf("Failed parsing filename %s: it is not absolute", path);
- fail:
- talloc_free(dir);
- return -1;
+ goto fail;
}
/*