Skip to content

Commit 01014e0

Browse files
committed
use bool for the debug flag
also reorder includes
1 parent 95f7445 commit 01014e0

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

race/sem-fixed-race.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,21 @@
99

1010
#define _XOPEN_SOURCE 700
1111

12-
#include <sys/types.h>
13-
#include <sys/wait.h>
14-
#include <sys/ipc.h>
15-
#include <sys/stat.h>
16-
#include <sys/sem.h>
17-
#include <sys/mman.h>
1812
#include <stdio.h>
13+
#include <stdbool.h>
1914
#include <stdlib.h>
2015
#include <fcntl.h>
2116
#include <unistd.h>
2217
#include <string.h>
2318
#include <signal.h>
2419
#include <errno.h>
2520
#include <err.h>
21+
#include <sys/types.h>
22+
#include <sys/wait.h>
23+
#include <sys/ipc.h>
24+
#include <sys/stat.h>
25+
#include <sys/sem.h>
26+
#include <sys/mman.h>
2627

2728
unsigned long i; /* number of loops per process */
2829
/* u_long should be enough for basic demo */
@@ -75,13 +76,13 @@ main(int argc, char **argv)
7576
{
7677
key_t key;
7778
char c = 0;
78-
int dbg = 0;
79+
bool dbg = false;
7980
struct sigaction act;
8081

8182
if (argc == 1)
8283
printf("run with any argument to see some debug info\n");
8384
else
84-
dbg = 1;
85+
dbg = true;
8586

8687
/* get a semaphore */
8788
key = ftok("/etc/passwd", 0);

0 commit comments

Comments
 (0)