#48043 nunc-stans config struct should be protected with an initializer
Closed: wontfix None Opened 9 years ago by rmeggins.

If you just do

struct ns_thrpool_config config;
ns_thrpool_new(&config);

you will get a lot of problems. Or if you only want to set certain parameters and leave the other ones as their default values. There should be a new function - ns_thrpool_config_init(&config). This will set the config values to their defaults, and will set a flag in the config structure:

ns_thrpool.h:
struct ns_thrpool_config {
    int init_flag; /* if set to the magic value, has been initialized properly */
...
}

ns_thrpool.c:
#define NS_INIT_MAGIC 0xdefa014
void
ns_thrpool_config_init(*config)
{
... set default values ...
    config->init_flag = NS_INIT_MAGIC;
    return;
}

PRStatus
ns_thrpool_new(*config)
{
    if (config->init_flag != NS_INIT_MAGIC) {
        log_something(error, not initialized properly);
        return PR_FAILURE;
    }
}

That way, the config struct must be initialized properly, unless the user goes out of the way to find the init_flag and set it.


To git+ssh://git.engineering.redhat.com/srv/git/users/mareynol/nunc-stans.git
c89dcbf..010992f mreynolds -> mreynolds
commit 010992fd049811deb771e9db0ee73e5e0033ed2e

To git+ssh://git.engineering.redhat.com/srv/git/users/mareynol/ds.git
5ab764a..8db3d1a nunc-stans -> nunc-stans
commit 8db3d1a65267df14af323b5ef89c44ce003198f9

Metadata Update from @mreynolds:
- Issue assigned to mreynolds
- Issue set to the milestone: 1.3.4 backlog

7 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/1374

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: Fixed)

3 years ago

Login to comment on this ticket.

Metadata