Make freerdp_handle_signals return an int, return -1 and set errno to ENOSYS on Windows for now

This commit is contained in:
Shea Levy 2011-09-28 02:48:18 -04:00
parent 71da4593c2
commit aed1a8f129
2 changed files with 14 additions and 2 deletions

View File

@ -20,6 +20,7 @@
#ifndef __UTILS_SIGNAL_H #ifndef __UTILS_SIGNAL_H
#define __UTILS_SIGNAL_H #define __UTILS_SIGNAL_H
#ifndef _WIN32
#include <signal.h> #include <signal.h>
#include <termios.h> #include <termios.h>
#include <freerdp/api.h> #include <freerdp/api.h>
@ -28,7 +29,8 @@ extern volatile sig_atomic_t terminal_needs_reset;
extern int terminal_fildes; extern int terminal_fildes;
extern struct termios orig_flags; extern struct termios orig_flags;
extern struct termios new_flags; extern struct termios new_flags;
#endif
FREERDP_API void freerdp_handle_signals(void); FREERDP_API int freerdp_handle_signals(void);
#endif /* __UTILS_SIGNAL_H */ #endif /* __UTILS_SIGNAL_H */

View File

@ -19,6 +19,14 @@
#include <stddef.h> #include <stddef.h>
#include <freerdp/utils/signal.h> #include <freerdp/utils/signal.h>
#ifdef _WIN32
#include <errno.h>
int freerdp_handle_signals(void)
{
errno = ENOSYS;
return -1;
}
#else
volatile sig_atomic_t terminal_needs_reset = 0; volatile sig_atomic_t terminal_needs_reset = 0;
int terminal_fildes = 0; int terminal_fildes = 0;
struct termios orig_flags; struct termios orig_flags;
@ -44,7 +52,7 @@ static void fatal_handler(int signum)
raise(signum); raise(signum);
} }
void freerdp_handle_signals(void) int freerdp_handle_signals(void)
{ {
const int fatal_signals[] = { const int fatal_signals[] = {
SIGABRT, SIGABRT,
@ -102,4 +110,6 @@ void freerdp_handle_signals(void)
&fatal_sigaction, NULL); &fatal_sigaction, NULL);
pthread_sigmask(SIG_SETMASK, &orig_set, NULL); pthread_sigmask(SIG_SETMASK, &orig_set, NULL);
return 0;
} }
#endif