From 38d40e08ff8b7fba7645ce16fbf3b30469d2a33b Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Mon, 4 Oct 2021 10:51:57 +0200 Subject: [PATCH] gsm0710muxd-hack: log: save to /data/local/tmp/ /tmp is not available in Android, so save to /data/local/tmp. --- src/gsm0710muxd-hack/src/gsm0710muxd.c | 8 ++++---- src/gsm0710muxd-hack/src/gsm0710muxd.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gsm0710muxd-hack/src/gsm0710muxd.c b/src/gsm0710muxd-hack/src/gsm0710muxd.c index cf8baa6..099b9e0 100644 --- a/src/gsm0710muxd-hack/src/gsm0710muxd.c +++ b/src/gsm0710muxd-hack/src/gsm0710muxd.c @@ -3154,7 +3154,7 @@ static int usage(char *_name) fprintf(stderr, "\t-m : Mode (basic, advanced) [%s]\n", cmux_mode ? "advanced" : "basic"); fprintf(stderr, "\t-f : Frame size [%d]\n", cmux_N1); fprintf(stderr, "\t-n : Number of virtual ports to create, must be in range 1-31 [%d]\n", vir_ports); - fprintf(stderr, "\t-o : Output log to /tmp/gsm0710muxd.log [%s]\n", logtofile ? "yes" : "no"); + fprintf(stderr, "\t-o : Output log to %s [%s]\n", LOG_FILE_PATH, logtofile ? "yes" : "no"); fprintf(stderr, "\t-h: Show this help message and show current settings.\n"); return -1; } @@ -3317,12 +3317,12 @@ int main(int argc, char *argv[]) break; case 'o': logtofile = 1; - if ((muxlogfile = fopen("/tmp/gsm0710muxd.log", "w+")) == NULL) { + if ((muxlogfile = fopen(LOG_FILE_PATH, "w+")) == NULL) { fprintf(stderr, "Error: %s.\n", strerror(errno)); usage(argv[0]); exit(0); } else { - fprintf(stderr, "gsm0710muxd log is output to /tmp/gsm0710muxd.log\n"); + fprintf(stderr, "gsm0710muxd log is output to %s\n", LOG_FILE_PATH); } break; case 'd': @@ -3428,7 +3428,7 @@ int main(int argc, char *argv[]) LOGMUX(LOG_NOTICE, "\t-m : Mode (basic, advanced) [%s]", cmux_mode ? "advanced" : "basic"); LOGMUX(LOG_NOTICE, "\t-f : Frame size [%d]", cmux_N1); LOGMUX(LOG_NOTICE, "\t-n : Number of virtual ports to create, must be in range 1-31 [%d]", vir_ports); - LOGMUX(LOG_NOTICE, "\t-o : Output log to /tmp/gsm0710muxd.log [%s]", logtofile ? "yes" : "no"); + LOGMUX(LOG_NOTICE, "\t-o : Output log to %s [%s]", LOG_FILE_PATH, logtofile ? "yes" : "no"); /* main_exit_signal is set via the function set_main_exit_signal() */ while ((main_exit_signal == 0) && ((rc = watchdog(&serial)) == 0)) { diff --git a/src/gsm0710muxd-hack/src/gsm0710muxd.h b/src/gsm0710muxd-hack/src/gsm0710muxd.h index 978b8d0..d6f1cb4 100644 --- a/src/gsm0710muxd-hack/src/gsm0710muxd.h +++ b/src/gsm0710muxd-hack/src/gsm0710muxd.h @@ -200,6 +200,7 @@ static int g_set_alarm_flag = 0; /******************************************************************************/ #define BAUDRATE B460800 +#define LOG_FILE_PATH "/data/local/tmp/gsm0710muxd.log" /*MUX defines */ #define GSM0710_FRAME_FLAG 0xF9 // basic mode flag for frame start and end