}
static int parse_fstab(const char *prefix, bool initrd) {
- FILE *f;
_cleanup_free_ char *fstab_path = NULL;
+ FILE *f;
int r = 0;
struct mntent *me;
- errno = 0;
- fstab_path = strjoin(prefix, "/etc/fstab", NULL);
+ fstab_path = strjoin(strempty(prefix), "/etc/fstab", NULL);
+ if (!fstab_path)
+ return log_oom();
+
f = setmntent(fstab_path, "r");
if (!f) {
if (errno == ENOENT)
if (!arg_enabled)
return (r < 0) ? EXIT_FAILURE : EXIT_SUCCESS;
- k = parse_fstab("", false);
+ k = parse_fstab(NULL, false);
if (in_initrd())
l = parse_fstab("/sysroot", true);