]> granicus.if.org Git - strace/commit
Don't risk truncating open flags by using mode_t
authorElliott Hughes <enh@google.com>
Wed, 24 Sep 2014 02:09:50 +0000 (19:09 -0700)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 3 Oct 2014 22:01:37 +0000 (22:01 +0000)
commit22e34b98578b8fab6be7fb608579e4fc601b2ed0
tree8b143ac886cfad51c7d0e86a58c853c7f72c3bb4
parent82a528d96fc49338441e93d1b04d51d6585f114f
Don't risk truncating open flags by using mode_t

On Android, 32-bit arm and x86 use __kernel_mode_t (an unsigned short)
as their mode_t.  The open(2) flags are actually an int, so high ones
like O_CLOEXEC get truncated if you coerce them to mode_t.

* defs.h (tprint_open_modes, sprint_open_modes): Change argument type
from mode_t to int.
* file.c (tprint_open_modes, sprint_open_modes): Likewise.

Signed-off-by: Elliott Hughes <enh@google.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
defs.h
file.c