From ce4fafd6377459d6b0a479b63e27ec85420e70ed Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Fri, 9 Dec 2005 05:01:22 +0000 Subject: [PATCH] Allow /etc/mdadm/mdadm.conf as an alternate to /etc/mdadm.conf This provide compatability with Debian. Signed-off-by: Neil Brown --- ChangeLog | 4 ++++ config.c | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 010d06ca..e0f6cb58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Changes Prior to this release + - Try /etc/mdadm/mdadm.conf if /etc/mdadm.conf doesn't exist. + This provided compatability for Debian. + Changes Prior to 2.2 release - Assorted bug fixes - Support write-intent-bitmaps on raid10 diff --git a/config.c b/config.c index b4445154..c09c2061 100644 --- a/config.c +++ b/config.c @@ -70,7 +70,12 @@ #ifndef CONFFILE #define CONFFILE "/etc/mdadm.conf" #endif +#ifndef CONFFILE2 +/* for Debian compatibility .... */ +#define CONFFILE2 "/etc/mdadm/mdadm.conf" +#endif char DefaultConfFile[] = CONFFILE; +char DefaultAltConfFile[] = CONFFILE2; char *keywords[] = { "device", "array", "mailaddr", "program", NULL }; @@ -455,7 +460,18 @@ void load_conffile(char *conffile) return; } f = fopen(conffile, "r"); - if (f ==NULL) + /* Debian chose to relocate mdadm.conf into /etc/mdadm/. + * To allow Debian users to compile from clean source and still + * have a working mdadm, we read /etc/mdadm/mdadm.conf + * if /etc/mdadm.conf doesn't exist + */ + if (f == NULL && + conffile == DefaultConfFile) { + f = fopen(DefaultAltConfFile, "r"); + if (f) + conffile = DefaultAltConfFile; + } + if (f == NULL) return; loaded = 1; -- 2.39.2