Allow overriding /etc/fstab with $SYSTEMD_FSTAB

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2019-11-13 22:04:51 +01:00
parent 32c6237a7c
commit ed4ad48897
6 changed files with 29 additions and 18 deletions
+2 -2
View File
@@ -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;
+4
View File
@@ -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";
}