void test_mkdir(const char *path)
{
	size_t len = strlen(path) + 30;
	char *tmpname = alloca(len);
	snprintf(tmpname, len, "%s/%d", path, (int)getpid());

	if (mkdir(path, 0755) == 0) {
		fprintf(stderr, "leak at mkdir of %s\n", path);
		exit(1);
	}
	if (errno != ENOENT) {
		fprintf(stderr, "leak at mkdir of %s, errno was %s\n", path, strerror(errno));
		exit(1);
	}
	if (mkdir(tmpname, 0755) == 0) {
		fprintf(stderr, "leak at mkdir of %s\n", tmpname);
		exit(1);
	}
	if (errno != ENOENT) {
		fprintf(stderr, "leak at mkdir of %s, errno was %s\n", path, strerror(errno));
		exit(1);
	}
}
Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control.