Merge pull request #1103 from s-wakaba/sunxi_linuxspi_support

saving errno of ioctl() call in a temporary variable to prevent overwrite
This commit is contained in:
Stefan Rueger 2022-10-05 22:02:42 +01:00 committed by GitHub
commit bc9137854b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -93,9 +93,10 @@ static int linuxspi_spi_duplex(const PROGRAMMER *pgm, const unsigned char *tx, u
errno = 0;
ret = ioctl(fd_spidev, SPI_IOC_MESSAGE(1), &tr);
if (ret != len) {
int ioctl_errno = errno;
avrdude_message(MSG_INFO, "\n%s: unable to send SPI message", progname);
if (errno)
avrdude_message(MSG_INFO, ". %s", strerror(errno));
if (ioctl_errno)
avrdude_message(MSG_INFO, ". %s", strerror(ioctl_errno));
avrdude_message(MSG_INFO, "\n");
}