[PATCH] daemon: Add sentinel attribute to commandf and commandrf
Causes a compiler warning to be emitted if you omit the trailing NULL argument. --- daemon/daemon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon/daemon.h b/daemon/daemon.h index 8f932d2..df1ba3a 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -100,9 +100,9 @@ extern char **split_lines (char *str); #define COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN 2048 extern int commandf (char **stdoutput, char **stderror, int flags, - const char *name, ...); + const char *name, ...) __attribute__((sentinel)); extern int commandrf (char **stdoutput, char **stderror, int flags, - const char *name, ...); + const char *name, ...) __attribute__((sentinel)); extern int commandvf (char **stdoutput, char **stderror, int flags, char const *const *argv); extern int commandrvf (char **stdoutput, char **stderror, int flags, -- 1.7.11.7
On Fri, Dec 14, 2012 at 02:01:08PM +0000, Matthew Booth wrote:
Causes a compiler warning to be emitted if you omit the trailing NULL argument. --- daemon/daemon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemon/daemon.h b/daemon/daemon.h index 8f932d2..df1ba3a 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -100,9 +100,9 @@ extern char **split_lines (char *str); #define COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN 2048
extern int commandf (char **stdoutput, char **stderror, int flags, - const char *name, ...); + const char *name, ...) __attribute__((sentinel)); extern int commandrf (char **stdoutput, char **stderror, int flags, - const char *name, ...); + const char *name, ...) __attribute__((sentinel)); extern int commandvf (char **stdoutput, char **stderror, int flags, char const *const *argv); extern int commandrvf (char **stdoutput, char **stderror, int flags, --
ACK. Any other functions we have that need to be marked this way? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
On 14/12/12 14:16, Richard W.M. Jones wrote:
On Fri, Dec 14, 2012 at 02:01:08PM +0000, Matthew Booth wrote:
Causes a compiler warning to be emitted if you omit the trailing NULL argument. --- daemon/daemon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemon/daemon.h b/daemon/daemon.h index 8f932d2..df1ba3a 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -100,9 +100,9 @@ extern char **split_lines (char *str); #define COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN 2048
extern int commandf (char **stdoutput, char **stderror, int flags, - const char *name, ...); + const char *name, ...) __attribute__((sentinel)); extern int commandrf (char **stdoutput, char **stderror, int flags, - const char *name, ...); + const char *name, ...) __attribute__((sentinel)); extern int commandvf (char **stdoutput, char **stderror, int flags, char const *const *argv); extern int commandrvf (char **stdoutput, char **stderror, int flags, --
ACK.
Any other functions we have that need to be marked this way?
I'm not currently motivated to do an audit, so I suggest we fix them as and when we stumble across them. Matt -- Matthew Booth, RHCA, RHCSS Red Hat Engineering, Virtualisation Team GPG ID: D33C3490 GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490
participants (2)
-
Matthew Booth -
Richard W.M. Jones