jmpews / Dobby

a lightweight, multi-platform, multi-architecture hook framework.
Apache License 2.0
4k stars 833 forks source link

Compile error (Android NDK) #150

Closed black-binary closed 3 years ago

black-binary commented 3 years ago
../Dobby/external/external-helper/variable_cache.c:67:55: error: 'open' called with O_CREAT or O_TMPFILE, but missing mode
  int fd = open(filepath, O_WRONLY | O_CREAT | O_TRUNC);
                                                      ^
/home/bb/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/bits/fortify/fcntl.h:65:9: note: from 'diagnose_if' attribute on 'open':
        __clang_error_if(__open_modes_useful(flags), "'open' " __open_too_few_args_error) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/bb/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/sys/cdefs.h:138:52: note: expanded from macro '__clang_error_if'
#define __clang_error_if(cond, msg) __attribute__((diagnose_if(cond, msg, "error")))

Here is my simple fix:

// int fd = open(filepath, O_WRONLY | O_CREAT | O_TRUNC);
int fd = open(filepath, O_WRONLY | O_CREAT | O_TRUNC, 0660);
jmpews commented 3 years ago

Fixed