author | Olivier Brunel
<jjk@jjacky.com> 2018-01-21 21:55:24 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2018-01-22 18:59:28 UTC |
parent | 7c24ff811731282516e4ac48bc2bbbe190fa58f7 |
doc/anopa-rc.pod | +2 | -2 |
src/anopa/aa-enable.c | +7 | -4 |
src/anopa/common.h | +4 | -3 |
src/include/anopa/rc.h | +0 | -1 |
diff --git a/doc/anopa-rc.pod b/doc/anopa-rc.pod index 6ab7473..f92e508 100644 --- a/doc/anopa-rc.pod +++ b/doc/anopa-rc.pod @@ -29,8 +29,6 @@ listed in the following table: +--------+-------+------------------------------+-----------------------+ | 7 | 3 | Memory error | | +--------+-------+------------------------------+-----------------------+ - | 9 | 4 | Failed to alarm s6 | Only for aa-enable | - +--------+-------+------------------------------+-----------------------+ | 111 | 55 | Failed to exec | | +--------+-------+------------------------------+-----------------------+ | 255 | 127 | Internal error | Shouldn't happen | @@ -60,4 +58,6 @@ of the following flags : +------+------+-------------------------------------------+----------------+ | 32 | 16 | At least one symlink couldn't be created | aa-enable only | +------+------+-------------------------------------------+----------------+ + | 64 | 32 | Failed to alarm s6-svscan | aa-enable only | + +------+------+-------------------------------------------+----------------+ diff --git a/src/anopa/aa-enable.c b/src/anopa/aa-enable.c index 0252f0b..a169675 100644 --- a/src/anopa/aa-enable.c +++ b/src/anopa/aa-enable.c @@ -449,10 +449,13 @@ main (int argc, char * const argv[]) if (alarm_s6) { r = s6_svc_writectl (AA_SCANDIR_DIRNAME, S6_SVSCAN_CTLDIR, "a", 1); - if (r < 0) - aa_strerr_diefu1sys (RC_FATAL_ALARM_S6, "alarm s6-svscan"); - else if (r == 0) - aa_strerr_diefu1x (RC_FATAL_ALARM_S6, "alarm s6-svscan: supervisor not listening"); + if (r <= 0) + { + aa_put_err ("Failed to alarm s6-svscan", + (r < 0) ? strerror (errno) : "supervisor not listening", + 1); + rc |= RC_ST_ALARM_S6; + } } if (ga_failed.len > 0) diff --git a/src/anopa/common.h b/src/anopa/common.h index 9d79fe4..1847f38 100644 --- a/src/anopa/common.h +++ b/src/anopa/common.h @@ -32,9 +32,10 @@ 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_SYMLINK = 1 << 5 /* at least 1 symlink couldn't be created */ + RC_ST_ESSENTIAL = 1 << 4, /* at least 1 failed service was essential (start) */ + /* enable only: */ + RC_ST_SYMLINK = 1 << 5, /* at least 1 symlink couldn't be created */ + RC_ST_ALARM_S6 = 1 << 6 /* failed to alarm s6 */ }; #endif /* _AA_COMMON_H */ diff --git a/src/include/anopa/rc.h b/src/include/anopa/rc.h index d6d1f92..a10dd21 100644 --- a/src/include/anopa/rc.h +++ b/src/include/anopa/rc.h @@ -39,7 +39,6 @@ enum RC_FATAL_INIT_REPO = (1 << 1 | 1), /* only by "commands" */ RC_FATAL_IO = (2 << 1 | 1), RC_FATAL_MEMORY = (3 << 1 | 1), - RC_FATAL_ALARM_S6 = (4 << 1 | 1), /* only by aa-enable */ RC_FATAL_EXEC = (55 << 1 | 1), /* so rc=111; execline style */