Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jul 99 2:31:49 PDT
From:      Adam Wight <adamw@holonet.net>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/12663: Ambiguous if statement.
Message-ID:  <199907160931.CAA01048@holonet.net>

next in thread | raw e-mail | index | archive | help

>Number:         12663
>Category:       kern
>Synopsis:       Ambiguous if statement
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 16 02:40:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Adam Wight
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
>Environment:
    all

>Description:
    The file sys/i386/apm/apm.c contains an ambiguous if...else statement
    that appears to be parsed correctly by the compiler, but could break
    silently depending on the compiler release.

>How-To-Repeat:

>Fix:

Sorry, you might have to use patch -l...

===================================================================
RCS file: /usr/cvs/src/sys/i386/apm/apm.c,v
retrieving revision 1.90
diff -c -r1.90 apm.c
*** apm.c   1999/07/10 18:08:48 1.90
--- apm.c   1999/07/13 17:45:38
***************  
*** 1283,1293 ****
    struct apm_softc *sc = &apm_softc;
    int revents = 0;

!   if (events & (POLLIN | POLLRDNORM))
!       if (sc->event_count)
            revents |= events & (POLLIN | POLLRDNORM);
!       else 
            selrecord(p, &sc->sc_rsel);

    return (revents);
  }  
--- 1283,1295 ----
    struct apm_softc *sc = &apm_softc;
    int revents = 0;

!   if (events & (POLLIN | POLLRDNORM)) {
!       if (sc->event_count) {
            revents |= events & (POLLIN | POLLRDNORM);
!       } else {
            selrecord(p, &sc->sc_rsel);
+       }
+   }

    return (revents);
  }


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907160931.CAA01048>