Skip to content

[BZ-1471] SV_Semaphore_Simple::op(int val,u_short n,int flags) disallows zero values #1471

@jwillemsen

Description

@jwillemsen
Field Value
Bugzilla ID 1471
Reporter mario.antonio
Assigned to DOC Center Support List (internal)
Product ACE
Component ACE Core
Version 5.3
Platform / OS SPARC / Solaris
Priority P3
Severity normal
Status NEW
Resolution
Created 2003-03-20 15:36:56 -0600

Originally posted by mario.antonio on 2003-03-20 15:36:56 -0600


The function ::semop, which is encapsulated by SV_Semaphore_Simple::op accepts a
zero value in sem_op attribute in sembuf. However the code disallows the zero
operation.I copied the verbatim code from the mentioned method.

Check the second 'if' statement, which disallows the operation of zero.

I actually WANT to use zero as operation and the present implementation of
ACE_SV_Semaphore_Simple::op does not allow me to do so.

The fix is only to remove the second 'if' condition.

int
ACE_SV_Semaphore_Simple::op (int val, u_short n, int flags) const
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::op");
sembuf op_op;

op_op.sem_num = n;
op_op.sem_flg = flags;

if (this->internal_id_ == -1)
return -1;
else if ((op_op.sem_op = val) == 0)
return -1;
else
return ACE_OS::semop (this->internal_id_, &op_op, 1);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions