From 0d7c9ac0916c5b42e2c8da681ab2a89b4cf62aa9 Mon Sep 17 00:00:00 2001 From: Andrew Wood Date: Sun, 1 Dec 2024 16:05:17 +0000 Subject: [PATCH] Address splint warnings. --- src/include/options.h | 2 +- src/main/options.c | 2 +- src/main/remote.c | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/include/options.h b/src/include/options.h index e10994e..ce2b332 100644 --- a/src/include/options.h +++ b/src/include/options.h @@ -43,7 +43,7 @@ struct opts_s { size_t buffer_size; /* buffer size, in bytes (0=default) */ off_t size; /* total size of data */ off_t error_skip_block; /* skip block size, 0 for adaptive */ - unsigned int remote; /* PID of pv to update settings of */ + pid_t remote; /* PID of pv to update settings of */ unsigned int skip_errors; /* skip read errors counter */ pid_t watch_pid; /* process to watch fds of */ int watch_fd; /* fd to watch */ diff --git a/src/main/options.c b/src/main/options.c index 53f7c63..68241b4 100644 --- a/src/main/options.c +++ b/src/main/options.c @@ -619,7 +619,7 @@ opts_t opts_parse(unsigned int argc, char **argv) } break; case 'R': - opts->remote = pv_getnum_count(optarg, false); + opts->remote = (pid_t) pv_getnum_count(optarg, false); break; case 'P': opts->pidfile = pv_strdup(optarg); diff --git a/src/main/remote.c b/src/main/remote.c index d71a2ae..df346b0 100644 --- a/src/main/remote.c +++ b/src/main/remote.c @@ -57,10 +57,12 @@ struct remote_msg { * file associated with a particular process ID; it will be opened for * writing if "sender" is true. Returns NULL on error. */ +/*@null@ */ +/*@dependent@ */ static FILE *pv__control_file(char *filename, size_t bufsize, pid_t control_pid, bool sender) { int open_flags, open_mode, control_fd; - FILE *control_fptr; + /*@dependent@ */ FILE *control_fptr = NULL; open_flags = O_RDONLY; #ifdef O_NOFOLLOW @@ -216,7 +218,7 @@ int pv_remote_set(opts_t opts, pvstate_t state) * Get the filename and file stream to use for remote control. */ memset(control_filename, 0, sizeof(control_filename)); - control_fptr = pv__control_file(control_filename, sizeof(control_filename), getpid(), true); + control_fptr = pv__control_file(control_filename, sizeof(control_filename), (pid_t) getpid(), true); if (NULL == control_fptr) { pv_error(state, "%s", strerror(errno)); return PV_ERROREXIT_REMOTE_OR_PID;