diff options
author | Eric Koegel <eric.koegel@gmail.com> | 2014-10-07 20:42:02 +0300 |
---|---|---|
committer | Eric Koegel <eric.koegel@gmail.com> | 2014-10-07 20:42:02 +0300 |
commit | 6d28a80ff36c3d3487bdfe9cb00d2dd99602ac12 (patch) | |
tree | 8a08451af4a28c23c87e5885870adf16302c3f60 | |
parent | b72817b36b982507b714c13f4ab64e2b93bd7cba (diff) | |
download | ConsoleKit2-6d28a80ff36c3d3487bdfe9cb00d2dd99602ac12.tar.gz |
Size of pointer 'P' used instead of size of its data.
CppCheck marks this as a warning that P might be used in sizeof
instead of P->tty_text so we'll use sizeof (P->tty_text) to make
it explicit.
-rw-r--r-- | src/ck-sysdeps-freebsd.c | 8 | ||||
-rw-r--r-- | src/ck-sysdeps-openbsd.c | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/ck-sysdeps-freebsd.c b/src/ck-sysdeps-freebsd.c index 3304c94..1d6d5b4 100644 --- a/src/ck-sysdeps-freebsd.c +++ b/src/ck-sysdeps-freebsd.c @@ -184,11 +184,11 @@ stat2proc (pid_t pid, snprintf (P->tty_text, sizeof P->tty_text, "%3d,%-3d", tty_maj, tty_min); if (p.kp_tdev != NODEV && (ttname = devname (p.kp_tdev, S_IFCHR)) != NULL) { - memcpy (P->tty_text, ttname, sizeof P->tty_text); + memcpy (P->tty_text, ttname, sizeof (P->tty_text)); } if (p.kp_tdev == NODEV) { - memcpy (P->tty_text, " ? ", sizeof P->tty_text); + memcpy (P->tty_text, " ? ", sizeof (P->tty_text)); } if (P->pid != pid) { @@ -244,11 +244,11 @@ stat2proc (pid_t pid, snprintf (P->tty_text, sizeof P->tty_text, "%3d,%-3d", tty_maj, tty_min); if (p.ki_tdev != NODEV && (ttname = devname (p.ki_tdev, S_IFCHR)) != NULL) { - memcpy (P->tty_text, ttname, sizeof P->tty_text); + memcpy (P->tty_text, ttname, sizeof (P->tty_text)); } if (p.ki_tdev == NODEV) { - memcpy (P->tty_text, " ? ", sizeof P->tty_text); + memcpy (P->tty_text, " ? ", sizeof (P->tty_text)); } if (P->pid != pid) { diff --git a/src/ck-sysdeps-openbsd.c b/src/ck-sysdeps-openbsd.c index e87698a..29bb4ba 100644 --- a/src/ck-sysdeps-openbsd.c +++ b/src/ck-sysdeps-openbsd.c @@ -191,15 +191,15 @@ stat2proc (pid_t pid, snprintf (P->tty_text, sizeof P->tty_text, "%3d,%-3d", tty_maj, tty_min); if (p.p_tdev != NODEV && (ttname = devname (p.p_tdev, S_IFCHR)) != NULL) { - memcpy (P->tty_text, ttname, sizeof P->tty_text); + memcpy (P->tty_text, ttname, sizeof (P->tty_text)); } if (p.p_tdev == NODEV) { /* XXX how do we associate X with its tty? */ #if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) - memcpy (P->tty_text, "/dev/ttyC4", sizeof P->tty_text); + memcpy (P->tty_text, "/dev/ttyC4", sizeof (P->tty_text)); #else - memcpy (P->tty_text, "/dev/ttyC0", sizeof P->tty_text); + memcpy (P->tty_text, "/dev/ttyC0", sizeof (P->tty_text)); #endif } |