#1704 Wrong error handler in sss_mc_create_file
Closed: Fixed None Opened 6 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

2 years ago

Login to comment on this ticket.

Metadata