author | Olivier Brunel
<jjk@jjacky.com> 2018-01-21 21:41:41 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2018-01-21 21:41:41 UTC |
parent | fbec9dfec48233a0450c64acbc61b669a905aa29 |
doc/anopa-rc.pod | +14 | -12 |
src/anopa/aa-enable.c | +10 | -4 |
src/anopa/common.h | +3 | -1 |
diff --git a/doc/anopa-rc.pod b/doc/anopa-rc.pod index 72e53c7..6ab7473 100644 --- a/doc/anopa-rc.pod +++ b/doc/anopa-rc.pod @@ -46,16 +46,18 @@ For commands (B<aa-start>(1), B<aa-stop>(1), B<aa-enable>(1), B<aa-status>(1), B<aa-reset>(1)), the remaining 7bit integer is actually a bitwise combination of the following flags : - +------+------+-------------------------------------------+---------------+ - | RC | 7bit | Meaning | Notes | - | flag | flag | | | - +------+------+-------------------------------------------+---------------+ - | 2 | 1 | At least one service was unknown | | - +------+------+-------------------------------------------+---------------+ - | 4 | 2 | At least one service was skipped | aa-start only | - +------+------+-------------------------------------------+---------------+ - | 8 | 4 | At least one service failed | | - +------+------+-------------------------------------------+---------------+ - | 16 | 8 | At least one failed service was essential | aa-start only | - +------+------+-------------------------------------------+---------------+ + +------+------+-------------------------------------------+----------------+ + | RC | 7bit | Meaning | Notes | + | flag | flag | | | + +------+------+-------------------------------------------+----------------+ + | 2 | 1 | At least one service was unknown | | + +------+------+-------------------------------------------+----------------+ + | 4 | 2 | At least one service was skipped | aa-start only | + +------+------+-------------------------------------------+----------------+ + | 8 | 4 | At least one service failed | | + +------+------+-------------------------------------------+----------------+ + | 16 | 8 | At least one failed service was essential | aa-start only | + +------+------+-------------------------------------------+----------------+ + | 32 | 16 | At least one symlink couldn't be created | aa-enable only | + +------+------+-------------------------------------------+----------------+ diff --git a/src/anopa/aa-enable.c b/src/anopa/aa-enable.c index 4175f17..0252f0b 100644 --- a/src/anopa/aa-enable.c +++ b/src/anopa/aa-enable.c @@ -229,6 +229,7 @@ main (int argc, char * const argv[]) const char *set_finish = NULL; int i; int r; + int rc = RC_OK; if (!stralloc_catb (&aa_sa_sources, SOURCE_ETC, sizeof (SOURCE_ETC))) aa_strerr_diefu1sys (RC_FATAL_MEMORY, "stralloc_catb"); @@ -434,9 +435,15 @@ main (int argc, char * const argv[]) if ((set_crash || set_finish) && mkdir (SVSCANDIR, S_IRWXU) < 0) aa_put_err ("Failed to create " SVSCANDIR, strerror (errno), 1); if (set_crash && symlink (set_crash, SCANDIR_CRASH) < 0) + { aa_put_err ("Failed to create symlink " SCANDIR_CRASH, strerror (errno), 1); + rc |= RC_ST_SYMLINK; + } if (set_finish && symlink (set_finish, SCANDIR_FINISH) < 0) + { aa_put_err ("Failed to create symlink " SCANDIR_FINISH, strerror (errno), 1); + rc |= RC_ST_SYMLINK; + } } if (alarm_s6) @@ -448,11 +455,10 @@ main (int argc, char * const argv[]) aa_strerr_diefu1x (RC_FATAL_ALARM_S6, "alarm s6-svscan: supervisor not listening"); } - r = RC_OK; if (ga_failed.len > 0) - r |= RC_ST_FAILED; + rc |= RC_ST_FAILED; if (ga_unknown.len > 0) - r |= RC_ST_UNKNOWN; + rc |= RC_ST_UNKNOWN; genalloc_free (size_t, &ga_failed); genalloc_free (size_t, &ga_unknown); @@ -460,5 +466,5 @@ main (int argc, char * const argv[]) stralloc_free (&sa_pl); stralloc_free (&names); - return r; + return rc; } diff --git a/src/anopa/common.h b/src/anopa/common.h index 2745b12..9d79fe4 100644 --- a/src/anopa/common.h +++ b/src/anopa/common.h @@ -32,7 +32,9 @@ enum RC_ST_UNKNOWN = 1 << 1, /* at least 1 service unknown */ RC_ST_SKIPPED = 1 << 2, /* at least 1 service skipped (start) */ RC_ST_FAILED = 1 << 3, /* at least 1 service failed */ - RC_ST_ESSENTIAL = 1 << 4 /* at least 1 failed service was essential */ + RC_ST_ESSENTIAL = 1 << 4, /* at least 1 failed service was essential */ + + RC_ST_SYMLINK = 1 << 5 /* at least 1 symlink couldn't be created */ }; #endif /* _AA_COMMON_H */