ElektraInitiative/libelektra — pull request #67 by pinotree (2014-08-16 08:05:48+00:00)
Title: Fix KEY_MODE vararg when mode_t is not int

When `mode_t` is not a typedef for `int` but `short` (as it happens on GNU/kFreeBSD), taking the `mode_t` vararg for `KEY_MODE` in `keyVNew` can crash. This happens because in code like
```c
Key *k = keyNew("user/foo", KEY_MODE, 0644, KEY_END);
```
the mode is implicitly represented as `int`.

The proposed solution is instead to always get the mode as `int`, which will get the right value.

The pull request also adds cmake checks for the size of `mode_t`, using it to enable the part of `test_meta.c` for large values of modes only when `mode_t` is big enough to hold those values.