void create_empty_file_as_root(const char *fname, mode_t mode) {
	assert(fname);
	mode &= 07777;
	struct stat s;

	if (stat(fname, &s)) {
		if (arg_debug)
			printf("Creating empty %s file\n", fname);
		/* coverity[toctou] */
		// don't fail if file already exists. This can be the case in a race
		// condition, when two jails launch at the same time. Compare to #1013
		mode_t tmp = umask(~mode); // let's avoid an extra chmod race
		int fd = open(fname, O_RDONLY|O_CREAT|O_CLOEXEC, mode);
		umask(tmp);
		if (fd < 0)
			errExit("open");
		close(fd);
	}

	ASSERT_PERMS(fname, 0, 0, mode);
}
void create_empty_file_as_root(const char *fname, mode_t mode) {
	assert(fname);
	mode &= 07777;
	struct stat s;

	if (stat(fname, &s)) {
		if (arg_debug)
			printf("Creating empty %s file\n", fname);
		 
		 
		 
		mode_t tmp = umask(~mode);  
		int fd = open(fname, O_RDONLY|O_CREAT|O_CLOEXEC, mode);
		umask(tmp);
		if (fd < 0)
			errExit("open");
		close(fd);
	}

	ASSERT_PERMS(fname, 0, 0, mode);
}