diff options
author | NeilBrown <neilb@suse.de> | 2023-03-13 14:42:58 +1100 |
---|---|---|
committer | Jes Sorensen <jes@trained-monkey.org> | 2023-03-19 12:33:16 -0400 |
commit | eb45d0add7cf2918f838bec2d93d99cf2d9c662f (patch) | |
tree | 43ca938fff7fa3cd5ed84ed4e932d16301fddf54 | |
parent | 566844b93e6823a04ed65827ba3e03cb123b3a03 (diff) | |
download | mdadm-eb45d0add7cf2918f838bec2d93d99cf2d9c662f.tar.gz |
Use existence of /etc/initrd-release to detect initrd.
Since v183, systemd has used the existence of /etc/initrd-release to
detect if it is running in an initrd, rather than looking at the magic
number of the root filesystem's device. It is time for mdadm to do the
same.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
-rw-r--r-- | util.c | 10 |
1 files changed, 1 insertions, 9 deletions
@@ -2227,15 +2227,7 @@ int continue_via_systemd(char *devnm, char *service_name) int in_initrd(void) { - /* This is based on similar function in systemd. */ - struct statfs s; - /* statfs.f_type is signed long on s390x and MIPS, causing all - sorts of sign extension problems with RAMFS_MAGIC being - defined as 0x858458f6 */ - return statfs("/", &s) >= 0 && - ((unsigned long)s.f_type == TMPFS_MAGIC || - ((unsigned long)s.f_type & 0xFFFFFFFFUL) == - ((unsigned long)RAMFS_MAGIC & 0xFFFFFFFFUL)); + return access("/etc/initrd-release", F_OK) >= 0; } void reopen_mddev(int mdfd) |