Commit f4fa53cf authored by Zhang Ning's avatar Zhang Ning Committed by Andrei Vagin

Android NDK: __errno is already defined as a function

criu/log.c:356:16: error: called object type 'int' is not a function or function pointer
        int __errno = errno;
                      ^~~~~
/root/android-ndk/toolchains/llvm/prebuilt/linux-x86_64//sysroot/usr/include/errno.h:43:24: note: expanded from macro 'errno'
                ~~~~~~~^
criu/log.c:391:2: error: called object type 'int' is not a function or function pointer
        errno =  __errno;
        ^~~~~
/root/android-ndk/toolchains/llvm/prebuilt/linux-x86_64//sysroot/usr/include/errno.h:43:24: note: expanded from macro 'errno'

in Android NDK's errno.h:

42: int* __errno(void) __attribute_const__;
43: #define errno (*__errno())

so rename __errno to _errno to pass build

Cc: Chen Hu <hu1.chen@intel.com>
Signed-off-by: 's avatarZhang Ning <ning.a.zhang@intel.com>
Reviewed-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
Reviewed-by: 's avatarDmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@gmail.com>
parent de2c917a
...@@ -353,7 +353,7 @@ static void early_vprint(const char *format, unsigned int loglevel, va_list para ...@@ -353,7 +353,7 @@ static void early_vprint(const char *format, unsigned int loglevel, va_list para
void vprint_on_level(unsigned int loglevel, const char *format, va_list params) void vprint_on_level(unsigned int loglevel, const char *format, va_list params)
{ {
int fd, size, ret, off = 0; int fd, size, ret, off = 0;
int __errno = errno; int _errno = errno;
if (unlikely(loglevel == LOG_MSG)) { if (unlikely(loglevel == LOG_MSG)) {
fd = STDOUT_FILENO; fd = STDOUT_FILENO;
...@@ -388,7 +388,7 @@ void vprint_on_level(unsigned int loglevel, const char *format, va_list params) ...@@ -388,7 +388,7 @@ void vprint_on_level(unsigned int loglevel, const char *format, va_list params)
if (loglevel == LOG_ERROR) if (loglevel == LOG_ERROR)
log_note_err(buffer + buf_off); log_note_err(buffer + buf_off);
errno = __errno; errno = _errno;
} }
void print_on_level(unsigned int loglevel, const char *format, ...) void print_on_level(unsigned int loglevel, const char *format, ...)
......
...@@ -40,7 +40,7 @@ void test_msg(const char *format, ...) ...@@ -40,7 +40,7 @@ void test_msg(const char *format, ...)
va_list arg; va_list arg;
int off = 0; int off = 0;
char buf[TEST_MSG_BUFFER_SIZE]; char buf[TEST_MSG_BUFFER_SIZE];
int __errno = errno; int _errno = errno;
struct timeval tv; struct timeval tv;
struct tm *tm; struct tm *tm;
...@@ -65,5 +65,5 @@ skip: ...@@ -65,5 +65,5 @@ skip:
va_end(arg); va_end(arg);
write(2, buf, off); write(2, buf, off);
errno = __errno; errno = _errno;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment