X-Git-Url: https://git.sven.stormbind.net/?a=blobdiff_plain;ds=inline;f=libexfat%2Flog.c;h=f29f74b1d68c22f7702532a5bb933ea8709edc3b;hb=8188f61cdb5393c7c65e2a75fb342ac307483170;hp=fd8982bff7430901114ea4bbea428240c8a822bb;hpb=0c79c86cba9d783efa6e21a9d5090d296fa81992;p=sven%2Fexfat-utils.git

diff --git a/libexfat/log.c b/libexfat/log.c
index fd8982b..f29f74b 100644
--- a/libexfat/log.c
+++ b/libexfat/log.c
@@ -3,7 +3,7 @@
 	exFAT file system implementation library.
 
 	Free exFAT implementation.
-	Copyright (C) 2010-2015  Andrew Nayenko
+	Copyright (C) 2010-2018  Andrew Nayenko
 
 	This program is free software; you can redistribute it and/or modify
 	it under the terms of the GNU General Public License as published by
@@ -22,7 +22,11 @@
 
 #include "exfat.h"
 #include <stdarg.h>
+#ifdef __ANDROID__
+#include <android/log.h>
+#else
 #include <syslog.h>
+#endif
 #include <unistd.h>
 
 int exfat_errors;
@@ -43,8 +47,12 @@ void exfat_bug(const char* format, ...)
 	va_end(ap);
 	fputs(".\n", stderr);
 
+#ifdef __ANDROID__
+	__android_log_vprint(ANDROID_LOG_FATAL, PACKAGE, format, aq);
+#else
 	if (!isatty(STDERR_FILENO))
 		vsyslog(LOG_CRIT, format, aq);
+#endif
 	va_end(aq);
 
 	abort();
@@ -67,8 +75,12 @@ void exfat_error(const char* format, ...)
 	va_end(ap);
 	fputs(".\n", stderr);
 
+#ifdef __ANDROID__
+	__android_log_vprint(ANDROID_LOG_ERROR, PACKAGE, format, aq);
+#else
 	if (!isatty(STDERR_FILENO))
 		vsyslog(LOG_ERR, format, aq);
+#endif
 	va_end(aq);
 }
 
@@ -89,8 +101,12 @@ void exfat_warn(const char* format, ...)
 	va_end(ap);
 	fputs(".\n", stderr);
 
+#ifdef __ANDROID__
+	__android_log_vprint(ANDROID_LOG_WARN, PACKAGE, format, aq);
+#else
 	if (!isatty(STDERR_FILENO))
 		vsyslog(LOG_WARNING, format, aq);
+#endif
 	va_end(aq);
 }