linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] erofs-utils: fuse: disable backtrace if unsupported
       [not found] <20201217090625.22738-1-hsiangkao.ref@aol.com>
@ 2020-12-17  9:06 ` Gao Xiang via Linux-erofs
  2020-12-17 14:23   ` Li GuiFu via Linux-erofs
  0 siblings, 1 reply; 2+ messages in thread
From: Gao Xiang via Linux-erofs @ 2020-12-17  9:06 UTC (permalink / raw)
  To: linux-erofs

From: Gao Xiang <hsiangkao@aol.com>

Let's enable backtrace conditionally since it's a GNU extension.

Fixes: 5e35b75ad499 ("erofs-utils: introduce fuse implementation")
Signed-off-by: Gao Xiang <hsiangkao@aol.com>
---
 configure.ac | 3 ++-
 fuse/main.c  | 8 ++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index d5fdfb8a3d17..28926c303c5c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,6 +96,7 @@ AC_ARG_VAR([LZ4_LIBS], [linker flags for lz4])
 # Checks for header files.
 AC_CHECK_HEADERS(m4_flatten([
 	dirent.h
+	execinfo.h
 	fcntl.h
 	getopt.h
 	inttypes.h
@@ -147,7 +148,7 @@ AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE, 1,
    #include <unistd.h>])
 
 # Checks for library functions.
-AC_CHECK_FUNCS([fallocate gettimeofday memset realpath strdup strerror strrchr strtoull])
+AC_CHECK_FUNCS([backtrace fallocate gettimeofday memset realpath strdup strerror strrchr strtoull])
 
 # Configure libuuid
 AS_IF([test "x$with_uuid" != "xno"], [
diff --git a/fuse/main.c b/fuse/main.c
index 1e24efe110c2..c16291272e75 100644
--- a/fuse/main.c
+++ b/fuse/main.c
@@ -6,7 +6,6 @@
  */
 #include <stdlib.h>
 #include <string.h>
-#include <execinfo.h>
 #include <signal.h>
 #include <libgen.h>
 #include <fuse.h>
@@ -168,6 +167,9 @@ static int optional_opt_func(void *data, const char *arg, int key,
 	return 1;
 }
 
+#if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE)
+#include <execinfo.h>
+
 static void signal_handle_sigsegv(int signal)
 {
 	void *array[10];
@@ -187,7 +189,7 @@ static void signal_handle_sigsegv(int signal)
 	erofs_dump("========================================\n");
 	abort();
 }
-
+#endif
 
 int main(int argc, char *argv[])
 {
@@ -197,11 +199,13 @@ int main(int argc, char *argv[])
 	erofs_init_configure();
 	fprintf(stderr, "%s %s\n", basename(argv[0]), cfg.c_version);
 
+#if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE)
 	if (signal(SIGSEGV, signal_handle_sigsegv) == SIG_ERR) {
 		fprintf(stderr, "failed to initialize signals\n");
 		ret = -errno;
 		goto err;
 	}
+#endif
 
 	/* parse options */
 	ret = fuse_opt_parse(&args, &fusecfg, option_spec, optional_opt_func);
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] erofs-utils: fuse: disable backtrace if unsupported
  2020-12-17  9:06 ` [PATCH] erofs-utils: fuse: disable backtrace if unsupported Gao Xiang via Linux-erofs
@ 2020-12-17 14:23   ` Li GuiFu via Linux-erofs
  0 siblings, 0 replies; 2+ messages in thread
From: Li GuiFu via Linux-erofs @ 2020-12-17 14:23 UTC (permalink / raw)
  To: Gao Xiang, linux-erofs



On 2020/12/17 17:06, Gao Xiang via Linux-erofs wrote:
> From: Gao Xiang <hsiangkao@aol.com>
> 
> Let's enable backtrace conditionally since it's a GNU extension.
> 
> Fixes: 5e35b75ad499 ("erofs-utils: introduce fuse implementation")
> Signed-off-by: Gao Xiang <hsiangkao@aol.com>
> ---
>  configure.ac | 3 ++-
>  fuse/main.c  | 8 ++++++--
>  2 files changed, 8 insertions(+), 3 deletions(-)
> 

It looks good
Reviewed-by: Li Guifu <bluce.lee@aliyun.com>
Thanks,

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-17 14:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20201217090625.22738-1-hsiangkao.ref@aol.com>
2020-12-17  9:06 ` [PATCH] erofs-utils: fuse: disable backtrace if unsupported Gao Xiang via Linux-erofs
2020-12-17 14:23   ` Li GuiFu via Linux-erofs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).