void touch_file_as_user(const char *fname, mode_t mode) {
	pid_t child = fork();
	if (child < 0)
		errExit("fork");
	if (child == 0) {
		// drop privileges
		drop_privs(0);

		int fd = open(fname, O_RDONLY|O_CREAT|O_EXCL|O_CLOEXEC, S_IRUSR | S_IWUSR);
		if (fd > -1) {
			int err = fchmod(fd, mode);
			(void) err;
			close(fd);
		}
		else
			fwarning("cannot create %s\n", fname);

		__gcov_flush();

		_exit(0);
	}
	// wait for the child to finish
	waitpid(child, NULL, 0);
}
void touch_file_as_user(const char *fname, mode_t mode) {
	pid_t child = fork();
	if (child < 0)
		errExit("fork");
	if (child == 0) {
		 
		drop_privs(0);

		int fd = open(fname, O_RDONLY|O_CREAT|O_EXCL|O_CLOEXEC, S_IRUSR | S_IWUSR);
		if (fd > -1) {
			int err = fchmod(fd, mode);
			(void) err;
			close(fd);
		}
		else
			fwarning("cannot create %s\n", fname);

		__gcov_flush();

		_exit(0);
	}
	 
	waitpid(child, NULL, 0);
}