summaryrefslogtreecommitdiff
path: root/src/libs6rcd/s6rc_service_resolve.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs6rcd/s6rc_service_resolve.c')
-rw-r--r--src/libs6rcd/s6rc_service_resolve.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/libs6rcd/s6rc_service_resolve.c b/src/libs6rcd/s6rc_service_resolve.c
index a786542..fe863be 100644
--- a/src/libs6rcd/s6rc_service_resolve.c
+++ b/src/libs6rcd/s6rc_service_resolve.c
@@ -9,10 +9,10 @@
#include "db.h"
-int s6rc_service_resolve (cdb_t *c, s6rc_sid_t *id, char const *s)
+int s6rc_service_resolve (cdb_t *c, char const *s, s6rc_id_t *id, char const **param)
{
size_t len = strlen(s) ;
- char const *param = 0 ;
+ char const *p = 0 ;
char pack[5] ;
int r = cdb_find(c, s, len) ;
if (r < 0) return r ;
@@ -23,11 +23,9 @@ int s6rc_service_resolve (cdb_t *c, s6rc_sid_t *id, char const *s)
if (at == len - 1) return (errno = EINVAL, -1) ;
r = cdb_find(c, s, at + 1) ;
if (r <= 0) return r ;
- param = s + at + 1 ;
+ p = s + at + 1 ;
}
- if (cdb_read(c, pack, 5, cdb_datapos(c)) < 0) return -1 ;
- id->stype = pack[0] ;
- uint32_unpack_big(pack + 1, &id->i) ;
- id->param = param ;
+ uint32_unpack_big(cdb_datapos(c), id) ;
+ *param = p ;
return 1 ;
}