Changeset 88ad75f in mainline for uspace/srv/sysman/units/unit_cfg.c


Ignore:
Timestamp:
2020-01-09T01:04:57Z (4 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
76c8209
Parents:
0939097
git-author:
Matthieu Riolo <matthieu.riolo@…> (2020-01-05 19:24:23)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2020-01-09 01:04:57)
Message:

repo_add_unit() returned an errno_t but it was never handled. This
commit adds a check if EOK is returned or else the repo will be left
unchanged

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/sysman/units/unit_cfg.c

    r0939097 r88ad75f  
    155155        DIR *dir;
    156156        struct dirent *de;
     157        errno_t rc;
    157158
    158159        dir = opendir(path);
     
    167168        while ((de = readdir(dir))) {
    168169                unit_t *unit = NULL;
    169                 errno_t rc = cfg_parse_file(path, de->d_name, &unit);
     170                rc = cfg_parse_file(path, de->d_name, &unit);
    170171                if (rc != EOK) {
    171172                        sysman_log(LVL_WARN, "Cannot load unit from file %s/%s",
     
    179180
    180181                assert(unit->repo_state == REPO_EMBRYO);
    181                 repo_add_unit(unit);
     182                rc = repo_add_unit(unit);
     183                if (rc != EOK)
     184                        goto error;
     185
    182186        }
    183187        closedir(dir);
    184188
    185         errno_t rc = repo_resolve_references();
    186         if (rc != EOK) {
    187                 repo_rollback();
    188                 return rc;
    189         }
     189        rc = repo_resolve_references();
     190        if (rc != EOK)
     191                goto error;
    190192
    191193        repo_commit();
    192194        return EOK;
     195
     196error:
     197        repo_rollback();
     198        return rc;
    193199}
    194200
Note: See TracChangeset for help on using the changeset viewer.