static void fs_remount_rec(const char *path, OPERATION op) {
	EUID_ASSERT();
	assert(op < OPERATION_MAX);
	assert(path);

	// no need to search /proc/self/mountinfo for submounts if not a directory
	int fd = open(path, O_PATH|O_DIRECTORY|O_NOFOLLOW|O_CLOEXEC);
	if (fd < 0) {
		fs_remount_simple(path, op);
		return;
	}

	// get mount id of the directory
	int mountid = get_mount_id(fd);
	close(fd);
	if (mountid < 0) {
		// falling back to a simple remount
		fwarning("%s %s not applied recursively\n", opstr[op], path);
		fs_remount_simple(path, op);
		return;
	}

	// build array with all mount points that need to get remounted
	char **arr = build_mount_array(mountid, path);
	if (!arr)
		return;
	// remount
	int i;
	for (i = 0; arr[i]; i++) {
		fs_remount_simple(arr[i], op);
		free(arr[i]);
	}
	free(arr);
}
static void fs_remount_rec(const char *path, OPERATION op) {
	EUID_ASSERT();
	assert(op < OPERATION_MAX);
	assert(path);

	 
	int fd = open(path, O_PATH|O_DIRECTORY|O_NOFOLLOW|O_CLOEXEC);
	if (fd < 0) {
		fs_remount_simple(path, op);
		return;
	}

	 
	int mountid = get_mount_id(fd);
	close(fd);
	if (mountid < 0) {
		 
		fwarning("%s %s not applied recursively\n", opstr[op], path);
		fs_remount_simple(path, op);
		return;
	}

	 
	char **arr = build_mount_array(mountid, path);
	if (!arr)
		return;
	 
	int i;
	for (i = 0; arr[i]; i++) {
		fs_remount_simple(arr[i], op);
		free(arr[i]);
	}
	free(arr);
}