Skip to content

Commit 4e6d207

Browse files
j6tgitster
authored andcommitted
mingw.h: add dummy functions for sigset_t operations
Windows does not have POSIX-like signals, and so we ignore all operations on the non-existent signal mask machinery. Do not turn sigemptyset into a function, but leave it a macro that erases the code in the argument because it is used to set sa_mask of a struct sigaction, but our dummy in mingw.h does not have that member. Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7559a1b commit 4e6d207

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

compat/mingw.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ struct sigaction {
6969
sig_handler_t sa_handler;
7070
unsigned sa_flags;
7171
};
72-
#define sigemptyset(x) (void)0
7372
#define SA_RESTART 0
7473

7574
struct itimerval {
@@ -116,6 +115,12 @@ static inline int fcntl(int fd, int cmd, ...)
116115
}
117116
/* bash cannot reliably detect negative return codes as failure */
118117
#define exit(code) exit((code) & 0xff)
118+
#define sigemptyset(x) (void)0
119+
static inline int sigaddset(sigset_t *set, int signum)
120+
{ return 0; }
121+
#define SIG_UNBLOCK 0
122+
static inline int sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
123+
{ return 0; }
119124

120125
/*
121126
* simple adaptors

t/t0005-signals.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ test_expect_success 'create blob' '
3939
git add file
4040
'
4141

42-
test_expect_success 'a constipated git dies with SIGPIPE' '
42+
test_expect_success !MINGW 'a constipated git dies with SIGPIPE' '
4343
OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 )
4444
test "$OUT" -eq 141
4545
'
4646

47-
test_expect_success 'a constipated git dies with SIGPIPE even if parent ignores it' '
47+
test_expect_success !MINGW 'a constipated git dies with SIGPIPE even if parent ignores it' '
4848
OUT=$( ((trap "" PIPE; large_git; echo $? 1>&3) | :) 3>&1 )
4949
test "$OUT" -eq 141
5050
'

0 commit comments

Comments
 (0)