fix: Complete conditional macros to fix errors when closing semaphore flags.

This commit is contained in:
fujr 2025-03-15 15:39:33 +08:00
parent 5e1dd089da
commit 3fad274cd1

View File

@ -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);
}