|
|
89be67 |
diff --git a/src/magic.c b/src/magic.c
|
|
|
89be67 |
index 5403951..2b61080 100644
|
|
|
89be67 |
--- a/src/magic.c
|
|
|
89be67 |
+++ b/src/magic.c
|
|
|
89be67 |
@@ -101,16 +101,21 @@ get_default_magic(void)
|
|
|
89be67 |
if ((home = getenv("HOME")) == NULL)
|
|
|
89be67 |
return MAGIC;
|
|
|
89be67 |
|
|
|
89be67 |
- if (asprintf(&hmagicpath, "%s/.magic", home) < 0)
|
|
|
89be67 |
+ if (asprintf(&hmagicpath, "%s/.magic.mgc", home) < 0)
|
|
|
89be67 |
return MAGIC;
|
|
|
89be67 |
- if (stat(hmagicpath, &st) == -1)
|
|
|
89be67 |
- goto out;
|
|
|
89be67 |
- if (S_ISDIR(st.st_mode)) {
|
|
|
89be67 |
+ if (stat(hmagicpath, &st) == -1) {
|
|
|
89be67 |
free(hmagicpath);
|
|
|
89be67 |
- if (asprintf(&hmagicpath, "%s/%s", home, hmagic) < 0)
|
|
|
89be67 |
+ if (asprintf(&hmagicpath, "%s/.magic", home) < 0)
|
|
|
89be67 |
return MAGIC;
|
|
|
89be67 |
- if (access(hmagicpath, R_OK) == -1)
|
|
|
89be67 |
+ if (stat(hmagicpath, &st) == -1)
|
|
|
89be67 |
goto out;
|
|
|
89be67 |
+ if (S_ISDIR(st.st_mode)) {
|
|
|
89be67 |
+ free(hmagicpath);
|
|
|
89be67 |
+ if (asprintf(&hmagicpath, "%s/%s", home, hmagic) < 0)
|
|
|
89be67 |
+ return MAGIC;
|
|
|
89be67 |
+ if (access(hmagicpath, R_OK) == -1)
|
|
|
89be67 |
+ goto out;
|
|
|
89be67 |
+ }
|
|
|
89be67 |
}
|
|
|
89be67 |
|
|
|
89be67 |
if (asprintf(&default_magic, "%s:%s", hmagicpath, MAGIC) < 0)
|