diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2015-07-14 20:11:53 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2015-07-14 20:11:53 +0000 |
commit | 9fdde3fe9f514f021728db63f387593c273f028e (patch) | |
tree | dd2eb58f790451318916ce66c1cfc701b69ff821 /src/libs6rc | |
parent | 08662f8255b6f168b75abc997769b41b69559082 (diff) | |
download | s6-rc-9fdde3fe9f514f021728db63f387593c273f028e.tar.xz |
Various bugfixes, thanks Colin Booth
(haven't touched the timeouts yet)
Diffstat (limited to 'src/libs6rc')
-rw-r--r-- | src/libs6rc/s6rc_db_read.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/libs6rc/s6rc_db_read.c b/src/libs6rc/s6rc_db_read.c index f10462c..7a38797 100644 --- a/src/libs6rc/s6rc_db_read.c +++ b/src/libs6rc/s6rc_db_read.c @@ -53,13 +53,10 @@ static inline int s6rc_db_read_services (buffer *b, s6rc_db_t *db) s6rc_service_t *sv = db->services ; unsigned int nargvs = db->nargvs ; unsigned int argvpos = 0 ; - char type ; -#ifdef DEBUG register unsigned int i = 0 ; -#endif - while (n--) + for (; i < n ; i++) { - DBG("iteration %u - %u remaining", i++, n) ; + DBG("iteration %u/%u remaining", i+1, n) ; if (!s6rc_db_read_uint32(b, &sv->name)) return -1 ; DBG(" name is %u: %s", sv->name, db->string + sv->name) ; if (sv->name >= db->stringlen) return 0 ; @@ -91,10 +88,8 @@ static inline int s6rc_db_read_services (buffer *b, s6rc_db_t *db) DBG(" dep on %u", db->deps[db->ndeps + sv->deps[1] + k]) ; } #endif - if (buffer_get(b, &type, 1) < 1) return -1 ; - if (type) + if (i < db->nlong) { - sv->type = 1 ; if (!s6rc_db_read_uint32(b, &sv->x.longrun.servicedir)) return -1 ; DBG(" longrun - servicedir is %u: %s", sv->x.longrun.servicedir, db->string + sv->x.longrun.servicedir) ; if (!s6rc_db_check_valid_string(db->string, db->stringlen, sv->x.longrun.servicedir)) return 0 ; @@ -103,7 +98,6 @@ static inline int s6rc_db_read_services (buffer *b, s6rc_db_t *db) { unsigned int i = 0 ; DBG(" oneshot") ; - sv->type = 0 ; for (; i < 2 ; i++) { uint32 pos, argc ; @@ -121,8 +115,11 @@ static inline int s6rc_db_read_services (buffer *b, s6rc_db_t *db) if (!nargvs--) return 0 ; db->argvs[argvpos++] = 0 ; } } - if (buffer_get(b, &type, 1) < 1) return -1 ; - if (type != '\376') return 0 ; + { + char c ; + if (buffer_get(b, &c, 1) < 1) return -1 ; + if (c != '\376') return 0 ; + } sv++ ; } if (nargvs) return 0 ; |