diff options
author | Liane Praza <Liane.Praza@Sun.COM> | 2008-10-20 14:39:03 -0700 |
---|---|---|
committer | Liane Praza <Liane.Praza@Sun.COM> | 2008-10-20 14:39:03 -0700 |
commit | 1f6eb0216cb17ca5fdff9563329f1dda47c8b801 (patch) | |
tree | effd496082281578b99a9135bce175687ab2483b /usr/src/lib/libscf/common/midlevel.c | |
parent | 376a7c81d94b461c5a3a73422b53976daac2bab4 (diff) | |
download | illumos-joyent-1f6eb0216cb17ca5fdff9563329f1dda47c8b801.tar.gz |
PSARC/2008/350 SMF Template Extensions
5100079 svccfg should use restarter-specific templates to validate services
6191768 consadm manifest does not define a stop method
6198434 service_bundle.dtd.1 claims exclude_all requires dependencies to be non-online
Diffstat (limited to 'usr/src/lib/libscf/common/midlevel.c')
-rw-r--r-- | usr/src/lib/libscf/common/midlevel.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/usr/src/lib/libscf/common/midlevel.c b/usr/src/lib/libscf/common/midlevel.c index c12cab4027..f6ad278eda 100644 --- a/usr/src/lib/libscf/common/midlevel.c +++ b/usr/src/lib/libscf/common/midlevel.c @@ -26,6 +26,7 @@ #include "libscf_impl.h" +#include <assert.h> #include <libuutil.h> #include <stdio.h> #include <strings.h> @@ -1125,12 +1126,8 @@ get_instance_pg(scf_simple_handle_t *simple_h) return (NULL); } - if ((namelen = scf_limit(SCF_LIMIT_MAX_NAME_LENGTH)) == -1) { - if (scf_error() == SCF_ERROR_NOT_SET) { - (void) scf_set_error(SCF_ERROR_INTERNAL); - } - return (NULL); - } + namelen = scf_limit(SCF_LIMIT_MAX_NAME_LENGTH) + 1; + assert(namelen > 0); if ((pg_name = malloc(namelen)) == NULL) { if (scf_error() == SCF_ERROR_NOT_SET) { @@ -1668,11 +1665,10 @@ scf_simple_prop_get(scf_handle_t *hin, const char *instance, const char *pgname, if (scf_handle_decode_fmri(h, fmri_buf, NULL, svc, NULL, NULL, NULL, SCF_DECODE_FMRI_TRUNCATE) == -1) goto error1; - if ((fmri_sz = scf_limit(SCF_LIMIT_MAX_FMRI_LENGTH)) == - -1) { - (void) scf_set_error(SCF_ERROR_INTERNAL); - goto error1; - } + + fmri_sz = scf_limit(SCF_LIMIT_MAX_FMRI_LENGTH) + 1; + assert(fmri_sz > 0); + if (scf_service_to_fmri(svc, fmri_buf, fmri_sz) == -1) goto error1; if ((svcfmri = assemble_fmri(h, fmri_buf, pgname, @@ -1814,10 +1810,8 @@ scf_simple_app_props_get(scf_handle_t *hin, const char *inst_fmri) } } - if ((namelen = scf_limit(SCF_LIMIT_MAX_NAME_LENGTH)) == -1) { - (void) scf_set_error(SCF_ERROR_INTERNAL); - return (NULL); - } + namelen = scf_limit(SCF_LIMIT_MAX_NAME_LENGTH) + 1; + assert(namelen > 0); if ((inst = scf_instance_create(h)) == NULL || (svc = scf_service_create(h)) == NULL || @@ -2646,8 +2640,8 @@ scf_read_propvec(const char *fmri, const char *pgname, boolean_t running, case SCF_TYPE_TIME: { scf_time_t *time = prop->pv_ptr; - ret = scf_value_get_time(v, &time->st_sec, - &time->st_nanosec); + ret = scf_value_get_time(v, &time->t_seconds, + &time->t_ns); break; } case SCF_TYPE_OPAQUE: { @@ -2812,8 +2806,8 @@ top: case SCF_TYPE_TIME: { scf_time_t *time = prop->pv_ptr; - ret = scf_value_set_time(v[i], time->st_sec, - time->st_nanosec); + ret = scf_value_set_time(v[i], time->t_seconds, + time->t_ns); break; } case SCF_TYPE_OPAQUE: { |