Common shared memory module. Using O_CLOEXEC for opened files.

This commit is contained in:
sorgelig
2021-04-16 23:12:46 +08:00
parent 2899437499
commit 9cd404ea65
22 changed files with 186 additions and 240 deletions

View File

@@ -71,7 +71,7 @@ static int spi_open(int speed, int mode)
int fd ;
mode &= 3; // Mode is 0, 1, 2 or 3
if ((fd = open ("/dev/spidev1.0", O_RDWR)) < 0)
if ((fd = open("/dev/spidev1.0", O_RDWR | O_CLOEXEC)) < 0)
{
printf("Unable to open SPI device: %s\n", strerror (errno));
return -1;