Skip to content

Commit e639884

Browse files
committed
compat/alarm: include unistd.h if not Win
If not using the Windows compat, include unistd.h that declares alarm() according to the POSIX.
1 parent 763089e commit e639884

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/compat/alarm.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* using default SIGALRM action which is terminate).
77
*/
88
/*
9-
* Copyright (c) 2019 CESNET, z. s. p. o.
9+
* Copyright (c) 2019-2025 CESNET, zájmové sdružení právnických osob
1010
* All rights reserved.
1111
*
1212
* Redistribution and use in source and binary forms, with or without
@@ -38,15 +38,19 @@
3838
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3939
*/
4040

41-
#ifdef _WIN32
4241

4342
#ifndef COMPAT_ALARM_H
4443
#define COMPAT_ALARM_H
4544

45+
#ifdef _WIN32
46+
4647
#include "utils/macros.h"
4748

4849
EXTERN_C void alarm(unsigned int sec);
4950

51+
#else
52+
#include <unistd.h>
53+
#endif /* _WIN32 */
54+
5055
#endif // defined COMPAT_ALARM_H
5156

52-
#endif /* _WIN32 */

0 commit comments

Comments
 (0)