Fix: __sighandler_t is not portable

This commit is contained in:
Nikita Ivanov 2022-07-24 17:58:55 +05:00
parent 526dc2642f
commit 37b1549f79
No known key found for this signature in database
GPG Key ID: 6E656AC5B97B5133
3 changed files with 10 additions and 6 deletions

View File

@ -34,12 +34,6 @@ static void sig_handler_exit(int s)
do_exit = 1;
}
static int register_signal(int sig, __sighandler_t handler)
{
ERRCHK_RET_ERN(signal(sig, handler) == SIG_ERR);
return OK;
}
static int open_fifo(int *fd, char *f)
{
ERRCHK_RET_ERN((*fd = open(f, O_RDONLY | O_NONBLOCK)) == -1);

View File

@ -159,3 +159,9 @@ const char *get_ext(const char *path)
return dot;
}
int register_signal(int sig, SigHandler handler)
{
ERRCHK_RET_ERN(signal(sig, handler) == SIG_ERR);
return OK;
}

View File

@ -23,6 +23,8 @@
typedef int (*SpawnProg)(const void *);
typedef void (*SigHandler)(int);
extern char *program;
int spawn_redirect(const void *arg);
@ -39,4 +41,6 @@ int get_config_dir(char *buf, size_t len, char *name);
int mkpath(char* file_path, int mode);
const char *get_ext(const char *path);
int register_signal(int sig, SigHandler handler);
#endif