aboutgitcodebugslistschat
path: root/log.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-09-29 15:50:19 +1000
committerStefano Brivio <sbrivio@redhat.com>2023-10-04 23:23:35 +0200
commit6471c7d01b0aad9d144448290557fcd783562228 (patch)
tree07c664f50790f205080f64d02a2b860f3642e8f7 /log.c
parentfc8f0f8c48ef12edbf60f74f37024917f5812385 (diff)
downloadpasst-6471c7d01b0aad9d144448290557fcd783562228.tar
passt-6471c7d01b0aad9d144448290557fcd783562228.tar.gz
passt-6471c7d01b0aad9d144448290557fcd783562228.tar.bz2
passt-6471c7d01b0aad9d144448290557fcd783562228.tar.lz
passt-6471c7d01b0aad9d144448290557fcd783562228.tar.xz
passt-6471c7d01b0aad9d144448290557fcd783562228.tar.zst
passt-6471c7d01b0aad9d144448290557fcd783562228.zip
cppcheck: Make many pointers const
Newer versions of cppcheck (as of 2.12.0, at least) added a warning for pointers which could be declared to point at const data, but aren't. Based on that, make many pointers throughout the codebase const. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'log.c')
-rw-r--r--log.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/log.c b/log.c
index 63d7801..c57bc8d 100644
--- a/log.c
+++ b/log.c
@@ -216,7 +216,7 @@ void logfile_init(const char *name, const char *path, size_t size)
*
* #syscalls lseek ppc64le:_llseek ppc64:_llseek armv6l:_llseek armv7l:_llseek
*/
-static void logfile_rotate_fallocate(int fd, struct timespec *ts)
+static void logfile_rotate_fallocate(int fd, const struct timespec *ts)
{
char buf[BUFSIZ], *nl;
int n;
@@ -253,7 +253,7 @@ static void logfile_rotate_fallocate(int fd, struct timespec *ts)
* #syscalls lseek ppc64le:_llseek ppc64:_llseek armv6l:_llseek armv7l:_llseek
* #syscalls ftruncate
*/
-static void logfile_rotate_move(int fd, struct timespec *ts)
+static void logfile_rotate_move(int fd, const struct timespec *ts)
{
int header_len, write_offset, end, discard, n;
char buf[BUFSIZ], *nl;
@@ -318,7 +318,7 @@ out:
*
* fallocate() passed as EXTRA_SYSCALL only if FALLOC_FL_COLLAPSE_RANGE is there
*/
-static int logfile_rotate(int fd, struct timespec *ts)
+static int logfile_rotate(int fd, const struct timespec *ts)
{
if (fcntl(fd, F_SETFL, O_RDWR /* Drop O_APPEND: explicit lseek() */))
return -errno;