const char *filename, int line)
{
warnx(_("%s: parse error at line %d -- ignore"), filename, line);
- return 0;
+ return 1;
}
/*
const char *filename, int line)
{
warnx(_("%s: parse error at line %d"), filename, line);
- return 0;
+ return 1;
}
static char **append_tabfile(char **files, int *nfiles, char *filename)
return xstrdup(path);
}
+static int table_parser_errcb(struct libmnt_table *tb __attribute__((__unused__)),
+ const char *filename, int line)
+{
+ if (filename)
+ warnx(_("%s: parse error: ignore entry at line %d."),
+ filename, line);
+ return 1;
+}
+
static int is_active_swap(const char *filename)
{
if (!swaps) {
if (!mntcache)
mntcache = mnt_new_cache();
+ mnt_table_set_parser_errcb(swaps, table_parser_errcb);
mnt_table_set_cache(swaps, mntcache);
mnt_table_parse_swaps(swaps, NULL);
}
if (!mntcache)
mntcache = mnt_new_cache();
+ mnt_table_set_parser_errcb(mtab, table_parser_errcb);
mnt_table_set_cache(mtab, mntcache);
mnt_table_parse_mtab(mtab, NULL);
}
if (filename)
warnx(_("%s: parse error: ignore entry at line %d."),
filename, line);
- return 0;
+ return 1;
}
/*
struct libmnt_cache *mntcache;
+static int table_parser_errcb(struct libmnt_table *tb __attribute__((__unused__)),
+ const char *filename, int line)
+{
+ if (filename)
+ warnx(_("%s: parse error: ignore entry at line %d."),
+ filename, line);
+ return 1;
+}
+
struct libmnt_table *get_fstab(void)
{
if (!fstab) {
fstab = mnt_new_table();
if (!fstab)
return NULL;
+ mnt_table_set_parser_errcb(fstab, table_parser_errcb);
mnt_table_set_cache(fstab, mntcache);
if (mnt_table_parse_fstab(fstab, NULL) != 0)
return NULL;
if (!swaps)
return NULL;
mnt_table_set_cache(swaps, mntcache);
+ mnt_table_set_parser_errcb(swaps, table_parser_errcb);
if (mnt_table_parse_swaps(swaps, NULL) != 0)
return NULL;
}
if (filename)
warnx(_("%s: parse error: ignore entry at line %d."),
filename, line);
- return 0;
+ return 1;
}