Standard compliance use NAME_MAX and not MAXNAMLEN, the latter is UFS specific use PATH_MAX and not MAXPATHLEN, the latter is BSD va_arg has to be called with promoted types: va_arg(ap, short) is implementation defined (GCC builtin: abort()) va_arg(ap, int) is correct to get shorts important for mode_t (16bit vs 32bit) on my build machine, GCC treats it as error no O_SYNC, use O_FSYNC instead use of FILE