Changes between Initial Version and Version 1 of Ticket #9687, comment 10


Ignore:
Timestamp:
May 18, 2013, 1:02:10 AM (12 years ago)
Author:
anevilyak

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #9687, comment 10

    initial v1  
    1 Problem found: at http://cgit.haiku-os.org/haiku/tree/src/bin/coreutils/src/kill.c#L297 calls is_number, casting its pid argument to an intmax_t. However, on Haiku, pid_t is 32-bit while intmax_t is 64-bit. Consequently, when is_number() writes the resulting value back at http://cgit.haiku-os.org/haiku/tree/src/bin/coreutils/src/kill.c#n235 , it also smashes the next 4 bytes on the stack. AFAICT from opengroup.org, our pid_t and intmax_t definitions are both spec compliant though, so I'm uncertain as to how this code manages to work OK on other platforms. The simple solution would seem to be to change is_number to simply accept a pid_t* instead. Thoughts?
     1Problem found: at http://cgit.haiku-os.org/haiku/tree/src/bin/coreutils/src/kill.c#L297 send_signals() calls is_number, casting its pid argument to an intmax_t. However, on Haiku, pid_t is 32-bit while intmax_t is 64-bit. Consequently, when is_number() writes the resulting value back at http://cgit.haiku-os.org/haiku/tree/src/bin/coreutils/src/kill.c#n235 , it also smashes the next 4 bytes on the stack. AFAICT from opengroup.org, our pid_t and intmax_t definitions are both spec compliant though, so I'm uncertain as to how this code manages to work OK on other platforms. The simple solution would seem to be to change is_number to simply accept a pid_t* instead. Thoughts?