#1704 Wrong error handler in sss_mc_create_file
Closed: Fixed None Opened 7 years ago by jhrozek.

If the file open fails:

698    mc_ctx->fd = open(mc_ctx->file, O_CREAT | O_EXCL | O_RDWR, 0644);
At conditional (1): "mc_ctx->fd == -1" taking the true branch.
CID 12608: Argument cannot be negative (NEGATIVE_RETURNS)Variable "mc_ctx->fd" tests negative.
699    if (mc_ctx->fd == -1) {
700        ret = errno;

fd is -1 now, ret is != EOK. The code reaches the done handler:

17    if (ret) {
"mc_ctx->fd" is passed to a parameter that cannot be negative.
718        close(mc_ctx->fd);
719    }

We don't check the return value of close, so we probably won't notice it erroring out, but we can still make the error handler nicer.


Fields changed

owner: somebody => jhrozek
status: new => assigned

Fields changed

patch: 0 => 1

Coverity bug, no cloning needed.

rhbz: => 0

milestone: NEEDS_TRIAGE => SSSD 1.9.4
resolution: => fixed
status: assigned => closed

Metadata Update from @jhrozek:
- Issue assigned to jhrozek
- Issue set to the milestone: SSSD 1.9.4

3 years ago

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

This issue has been cloned to Github and is available here:
- https://github.com/SSSD/sssd/issues/2746

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.

Login to comment on this ticket.

Metadata