This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/19995] New: Linux syscall return value unnecessarily relies on implementation-defined behaviour


https://sourceware.org/bugzilla/show_bug.cgi?id=19995

            Bug ID: 19995
           Summary: Linux syscall return value unnecessarily relies on
                    implementation-defined behaviour
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: mt at debian dot org
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

It seems that ever since the very initial import (~14 years ago) the return
values of syscalls in sysdep.h were declared unsigned (unsigned int, unsigned
long), even though:

- Linux syscalls return signed values
- They are then cast back to signed (int, long)

The unsigned -> signed conversion is implementation-defined for any values that
cannot be represented in the signed type (as will be the case with any negative
return value if it's two's complement). This seems to be case where relying on
implementation-defined behaviour could be avoided.

Best,
Michael

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]