From f51c897d6874e2d3c5f3524449e0e82b93b0add2 Mon Sep 17 00:00:00 2001 From: Frank Theile Date: Tue, 3 Apr 2018 11:56:28 +0200 Subject: [PATCH] Consistent arguments to sizeof(). In calls to functions taking a pointer 'p' and a length 'l': if a struct variable v is passed in for p, then also pass sizeof(v) for l. --- canbusload.c | 2 +- slcand.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/canbusload.c b/canbusload.c index 8f6b10d..bf217b6 100644 --- a/canbusload.c +++ b/canbusload.c @@ -386,7 +386,7 @@ int main(int argc, char **argv) if (FD_ISSET(s[i], &rdfs)) { - nbytes = read(s[i], &frame, sizeof(struct can_frame)); + nbytes = read(s[i], &frame, sizeof(frame)); if (nbytes < 0) { perror("read"); diff --git a/slcand.c b/slcand.c index 9d97b3e..304c880 100644 --- a/slcand.c +++ b/slcand.c @@ -305,7 +305,7 @@ int main(int argc, char *argv[]) } /* Configure baud rate */ - memset(&tios, 0, sizeof(struct termios)); + memset(&tios, 0, sizeof(tios)); if (tcgetattr(fd, &tios) < 0) { syslogger(LOG_NOTICE, "failed to get attributes for TTY device %s: %s\n", ttypath, strerror(errno)); exit(EXIT_FAILURE);