Use a special type for opts->argv[] so that the whole array, and array entries, can both be NULL, and the array entries pointers to constant strings; and ensure that argv[] always has a NULL pointer on the end - all so argv can be passed to execvp() (#67).

This commit is contained in:
Andrew Wood
2026-03-19 22:57:41 +00:00
parent 29c65ad9e1
commit 04f99c4951
2 changed files with 7 additions and 3 deletions
+3 -1
View File
@@ -46,6 +46,8 @@ typedef enum {
PV_SIDE_BOTH /* monitor both sides */
} pvside_t;
typedef /*@null@*/ const char * argv_string;
/*
* Structure describing run-time options.
*
@@ -66,7 +68,7 @@ struct opts_s {
/*@keep@*/ /*@null@*/ char *extra_display; /* extra display specifier, if any */
/*@keep@*/ /*@null@*/ pid_t *watchfd_pid; /* array of processes to watch fds of */
/*@keep@*/ /*@null@*/ int *watchfd_fd; /* array of fds to watch in each one (0=all) */
/*@keep@*/ /*@null@*/ const char **argv; /* array of non-option arguments */
/*@keep@*/ /*@null@*/ argv_string *argv; /* array of non-option arguments */
size_t lastwritten; /* show N bytes last written */
off_t rate_limit; /* rate limit, in bytes per second */
size_t buffer_size; /* buffer size, in bytes (0=default) */