From 3fad274cd104306d63ee815f3a329b2143a467d7 Mon Sep 17 00:00:00 2001 From: fujr Date: Sat, 15 Mar 2025 15:39:33 +0800 Subject: [PATCH] fix: Complete conditional macros to fix errors when closing semaphore flags. --- application/tom_modem/src/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/application/tom_modem/src/main.c b/application/tom_modem/src/main.c index 128222b..7f19b49 100644 --- a/application/tom_modem/src/main.c +++ b/application/tom_modem/src/main.c @@ -157,10 +157,12 @@ int run_op(PROFILE_T *profile,FDS_T *fds) } static void clean_up() { +#ifdef USE_SEMAPHORE if (unlock_at_port(s_profile.tty_dev)) { err_msg("Failed to unlock tty device"); } +#endif dbg_msg("Clean up success"); if (s_fds.tty_fd >= 0) { @@ -208,14 +210,15 @@ int main(int argc, char *argv[]) err_msg("Failed to open tty device"); return COMM_ERROR; } - if (run_op(profile,fds)) { err_msg("Failed to run operation %d", profile->op); +#ifdef USE_SEMAPHORE if (unlock_at_port(profile->tty_dev)) { err_msg("Failed to unlock tty device"); } +#endif kill(getpid(), SIGINT); }