}
static int add_swap(const char *what, struct mntent *me) {
- _cleanup_free_ char *name = NULL, *unit = NULL, *lnk = NULL, *device = NULL;
+ _cleanup_free_ char *name = NULL, *unit = NULL, *lnk = NULL;
_cleanup_fclose_ FILE *f = NULL;
bool noauto;
int r, pri = -1;
const char *post,
const char *source) {
_cleanup_free_ char
- *name = NULL, *unit = NULL, *lnk = NULL, *device = NULL,
+ *name = NULL, *unit = NULL, *lnk = NULL,
*automount_name = NULL, *automount_unit = NULL;
_cleanup_fclose_ FILE *f = NULL;
}
static int parse_fstab(const char *prefix, bool initrd) {
- _cleanup_free_ char *fstab_path = NULL;
- FILE *f;
+ char *fstab_path;
+ _cleanup_endmntent_ FILE *f;
int r = 0;
struct mntent *me;
- fstab_path = strjoin(strempty(prefix), "/etc/fstab", NULL);
- if (!fstab_path)
- return log_oom();
-
+ fstab_path = strappenda(strempty(prefix), "/etc/fstab");
f = setmntent(fstab_path, "r");
if (!f) {
if (errno == ENOENT)
what = fstab_node_to_udev_node(me->mnt_fsname);
where = strjoin(strempty(prefix), me->mnt_dir, NULL);
- if (!what || !where) {
- r = log_oom();
- goto finish;
- }
+ if (!what || !where)
+ return log_oom();
if (is_path(where))
path_kill_slashes(where);
r = k;
}
-finish:
- endmntent(f);
return r;
}