Exemple #1
0
static void
cmd_init(struct g_bde_key *gl, int dfd, const char *f_opt, int i_opt, const char *l_opt)
{
	int i;
	u_char *buf;
	unsigned sector_size;
	uint64_t	first_sector;
	uint64_t	last_sector;
	uint64_t	total_sectors;
	off_t	off, off2;
	unsigned nkeys;
	const char *p;
	char *q, cbuf[BUFSIZ];
	unsigned u, u2;
	uint64_t o;
	properties	params;

	bzero(gl, sizeof *gl);
	if (f_opt != NULL) {
		i = open(f_opt, O_RDONLY);
		if (i < 0)
			err(1, "%s", f_opt);
		params = properties_read(i);
		close (i);
	} else if (i_opt) {
		/* XXX: Polish */
		asprintf(&q, "%stemp.XXXXXXXXXX", _PATH_TMP);
		if (q == NULL)
			err(1, "asprintf");
		i = mkstemp(q);
		if (i < 0)
			err(1, "%s", q);
		write(i, template, strlen(template));
Exemple #2
0
static int
plugins_zfssnap_load_conf(const char *file)
{
        int i;
	bool wrong_conf = false;

	assert(file != NULL);

	if ((plugins_zfssnap_fd = open(file, O_RDONLY)) < 0) {
                fprintf(stderr, ">>> Cannot open configuration file %s", file);
                return (EPKG_FATAL);
        }

	plugins_zfssnap_p = properties_read(plugins_zfssnap_fd);
	
        for (i = 0; c[i].key != NULL; i++)
		c[i].val = property_find(plugins_zfssnap_p, c[i].key);

	return (EPKG_OK);
}