Allow overriding /etc/fstab with $SYSTEMD_FSTAB
This commit is contained in:
@@ -19,7 +19,7 @@ int fstab_has_fstype(const char *fstype) {
|
||||
_cleanup_endmntent_ FILE *f = NULL;
|
||||
struct mntent *m;
|
||||
|
||||
f = setmntent("/etc/fstab", "re");
|
||||
f = setmntent(fstab_path(), "re");
|
||||
if (!f)
|
||||
return errno == ENOENT ? false : -errno;
|
||||
|
||||
@@ -39,7 +39,7 @@ int fstab_is_mount_point(const char *mount) {
|
||||
_cleanup_endmntent_ FILE *f = NULL;
|
||||
struct mntent *m;
|
||||
|
||||
f = setmntent("/etc/fstab", "re");
|
||||
f = setmntent(fstab_path(), "re");
|
||||
if (!f)
|
||||
return errno == ENOENT ? false : -errno;
|
||||
|
||||
|
||||
@@ -31,3 +31,7 @@ static inline bool fstab_test_yes_no_option(const char *opts, const char *yes_no
|
||||
}
|
||||
|
||||
char *fstab_node_to_udev_node(const char *p);
|
||||
|
||||
static inline const char* fstab_path(void) {
|
||||
return secure_getenv("SYSTEMD_FSTAB") ?: "/etc/fstab";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user