summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-06-11 07:05:54 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-06-11 07:05:54 +0000
commit8d6814eba88699036251b9cbea5e40e497e4f7dc (patch)
tree5f00cc0588d5f2a3dc31e4207d9bd68e9b897fc6 /src
parentbca445464cefca632c355011f29c102a3c4bc4e3 (diff)
downloads6-rc-8d6814eba88699036251b9cbea5e40e497e4f7dc.tar.xz
Add debug instructions to s6-rc
Diffstat (limited to 'src')
-rw-r--r--src/s6-rc/s6-rc.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/s6-rc/s6-rc.c b/src/s6-rc/s6-rc.c
index 0937379..2363556 100644
--- a/src/s6-rc/s6-rc.c
+++ b/src/s6-rc/s6-rc.c
@@ -357,7 +357,6 @@ int main (int argc, char const *const *argv)
if (t) tain_from_millisecs(&deadline, t) ;
else deadline = tain_infinite_relative ;
}
- if (!argc) dieusage() ;
if (!what.list && !what.listall) what.change = 1 ;
if (!tain_now_g())
strerr_warnwu1x("get correct TAI time. (Do you have a valid leap seconds file?)") ;
@@ -448,9 +447,9 @@ int main (int argc, char const *const *argv)
for (; *argv ; argv++)
{
unsigned int len ;
- register int r = cdb_find(&c, *argv, str_len(*argv)) ;
- char pack[cdb_datalen(&c) + 1] ;
- char const *p = pack ;
+ register int r ;
+ if (verbosity >= 4) strerr_warnt2x("looking up ", *argv) ;
+ r = cdb_find(&c, *argv, str_len(*argv)) ;
if (r < 0) strerr_diefu3sys(111, "read ", dbfn, "/resolve.cdb") ;
if (!r)
strerr_dief4x(3, *argv, " is not a recognized identifier in ", dbfn, "/resolve.cdb") ;
@@ -459,15 +458,25 @@ int main (int argc, char const *const *argv)
len = cdb_datalen(&c) >> 2 ;
if (len > n)
strerr_dief3x(4, "invalid resolve database in ", dbfn, "/resolve.cdb") ;
- if (cdb_read(&c, pack, cdb_datalen(&c), cdb_datapos(&c)) < 0)
- if (r < 0) strerr_diefu3sys(111, "read ", dbfn, "/resolve.cdb") ;
- while (len--)
{
- uint32 x ;
- uint32_unpack_big(p, &x) ; p += 4 ;
- if (x >= n)
- strerr_dief3x(4, "invalid resolve database in ", dbfn, "/resolve.cdb") ;
- state[x] |= 2 ;
+ char pack[cdb_datalen(&c) + 1] ;
+ char const *p = pack ;
+ if (cdb_read(&c, pack, cdb_datalen(&c), cdb_datapos(&c)) < 0)
+ if (r < 0) strerr_diefu3sys(111, "read ", dbfn, "/resolve.cdb") ;
+ while (len--)
+ {
+ uint32 x ;
+ uint32_unpack_big(p, &x) ; p += 4 ;
+ if (x >= n)
+ strerr_dief3x(4, "invalid resolve database in ", dbfn, "/resolve.cdb") ;
+ state[x] |= 2 ;
+ if (verbosity >= 4)
+ {
+ char fmt[UINT32_FMT] ;
+ fmt[uint320_fmt(fmt, x)] = 0 ;
+ strerr_warnt2x("adding service ", fmt) ;
+ }
+ }
}
}
cdb_free(&c) ;